/* Leagues / Teams pages — scoped to body.leagues-shell */

.leagues-shell {
  background: #fafaf7;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.lg-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}
.lg-page--narrow { max-width: 640px; }

.lg-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.lg-hero h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin: 6px 0 0;
}
.lg-sub { color: #5a5a55; margin: 8px 0 0; font-size: 0.95rem; }

.lg-section-h {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 24px 0 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #6a6a65;
}

.lg-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.lg-card { background: #fff; border: 1px solid #e5e5e0; border-radius: 12px; transition: box-shadow .15s ease, transform .15s ease; }
.lg-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.06); transform: translateY(-1px); }
.lg-card__link {
  display: block; padding: 18px 20px; text-decoration: none; color: inherit;
}
.lg-card__season {
  font-size: 0.78rem; color: #888; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 6px;
}
.lg-card__name { font-size: 1.1rem; font-weight: 600; margin: 0 0 6px; }
.lg-card__date { font-size: 0.85rem; color: #777; margin: 0; }

.lg-empty {
  background: #fff; border: 1px dashed #d4d4d0; border-radius: 12px;
  padding: 36px 24px; text-align: center;
}
.lg-empty h2 { font-size: 1.2rem; margin: 0 0 6px; }
.lg-empty p  { color: #5a5a55; margin: 0 0 16px; }
.lg-empty--inline { padding: 22px; }

.lg-error { color: #b00020; font-size: 0.92rem; margin-top: 12px; }

/* Forms */
.lg-form {
  background: #fff; border: 1px solid #e5e5e0; border-radius: 12px;
  padding: 24px; display: flex; flex-direction: column; gap: 16px; margin-top: 16px;
}
.lg-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.lg-field span { font-weight: 500; color: #2a2a25; }
.lg-field em { color: #888; font-style: normal; font-weight: 400; }
.lg-field input, .lg-field select {
  padding: 10px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid #d4d4d0; border-radius: 8px; background: #fff;
}
.lg-field input:focus, .lg-field select:focus {
  outline: 2px solid #1a1a1a33; border-color: #1a1a1a;
}
.lg-form__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; align-items: center; }
.lg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Block sections (roster, stats, games) */
.lg-block {
  background: #fff; border: 1px solid #e5e5e0; border-radius: 12px;
  padding: 20px 22px; margin-top: 20px;
}
.lg-block__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.lg-block__head h2 { font-size: 1.05rem; margin: 0; }
.lg-help { color: #888; font-size: 0.85rem; }

/* Tables */
.lg-table-wrap { overflow-x: auto; }
.lg-table {
  width: 100%; border-collapse: collapse; font-size: 0.92rem;
}
.lg-table th, .lg-table td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid #f0f0eb;
}
.lg-table th {
  background: #f9f9f4; font-weight: 600; color: #4a4a45;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
}
.lg-table--stats th, .lg-table--stats td { text-align: center; padding: 6px 8px; }
.lg-table--stats td:nth-child(2), .lg-table--stats th:nth-child(2) { text-align: left; }
.lg-table--stats td:first-child, .lg-table--stats th:first-child { width: 30px; color: #888; }
.lg-table tr:last-child td { border-bottom: none; }

/* Roster editor */
.lg-roster-edit__rows { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.lg-roster-edit__row {
  display: grid; grid-template-columns: 36px 2fr 1fr 1fr 32px; gap: 8px; align-items: center;
}
.lg-roster-edit__row input {
  padding: 8px 10px; font-size: 13px; font-family: inherit;
  border: 1px solid #d4d4d0; border-radius: 6px; background: #fff;
}
.lg-roster-edit__row .slot { color: #888; font-size: 0.85rem; text-align: center; }
.lg-roster-edit__row button.row-rm {
  background: transparent; border: none; color: #b00020; cursor: pointer; font-size: 1.1rem;
}

/* Games */
.lg-games { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.lg-game {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid #f0f0eb; border-radius: 8px;
}
.lg-game__meta { color: #5a5a55; font-size: 0.88rem; }
.lg-game a { color: #1a1a1a; text-decoration: none; font-weight: 500; }
.lg-game a:hover { text-decoration: underline; }

/* Modal */
.lg-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.lg-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.lg-modal__panel {
  position: relative; background: #fff; border-radius: 14px; padding: 24px;
  width: min(560px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0,0,0,.18);
  max-height: calc(100vh - 64px); overflow-y: auto;
}
.lg-modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.lg-modal__head h3 { margin: 0; font-size: 1.1rem; }
.lg-modal__close { background: transparent; border: none; font-size: 1.5rem; cursor: pointer; color: #888; line-height: 1; }
.lg-modal__body { display: flex; flex-direction: column; gap: 14px; }

/* Buttons-small variant if not present in main.css */
.btn--sm { padding: 6px 12px; font-size: 0.85rem; }

/* Hero action group + empty-state actions */
.lg-hero__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lg-empty__actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Card top row + role pill */
.lg-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 18px; margin-bottom: 4px; }
.lg-pill {
  display: inline-flex; align-items: center;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: 999px;
  background: #f0f0eb; color: #4a4a45;
}
.lg-card--readonly { opacity: 0.85; }
.lg-card--readonly .lg-card__link { cursor: default; }
.lg-card--readonly:hover { box-shadow: none; transform: none; }

/* Members list */
.lg-members { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.lg-member {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 8px 10px; border: 1px solid #f0f0eb; border-radius: 8px;
  font-size: 0.9rem;
}
.lg-member__id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #555; }
.lg-member__date { color: #888; font-size: 0.85rem; }

/* Invite UI */
.lg-invite-preview {
  background: #f9f9f4; border: 1px solid #e5e5e0; border-radius: 10px;
  padding: 14px 16px; margin-top: -4px;
}
.lg-invite-preview__name { font-size: 1.1rem; font-weight: 600; margin: 4px 0 6px; }

.lg-invites { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.lg-invite {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid #f0f0eb; border-radius: 8px;
  background: #fff; font-size: 0.92rem;
}
.lg-invite--empty { display: block; text-align: center; color: #888; padding: 16px; }
.lg-invite__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem; letter-spacing: 0.06em; padding: 4px 10px;
  background: #1a1a1a; color: #fafaf7; border-radius: 6px;
}
.lg-invite__meta { color: #6a6a65; font-size: 0.85rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lg-stat-grid,
.lg-billing-grid,
.lg-settings-grid,
.lg-plan-grid {
  display: grid;
  gap: 14px;
}
.lg-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}
.lg-billing-grid,
.lg-settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.lg-plan-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.lg-metric,
.lg-plan-card {
  background: #fff;
  border: 1px solid #e5e5e0;
  border-radius: 8px;
  padding: 16px;
}
.lg-metric span,
.lg-usage__meta span {
  display: block;
  color: #777;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.lg-metric strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
  margin-top: 8px;
}
.lg-search input {
  width: 220px;
  padding: 9px 12px;
  border: 1px solid #d4d4d0;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.lg-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0eb;
}
.lg-toggle:last-of-type { border-bottom: 0; }
.lg-toggle input { width: 18px; height: 18px; margin-top: 2px; }
.lg-toggle strong,
.lg-toggle small {
  display: block;
}
.lg-toggle small {
  color: #777;
  margin-top: 2px;
}
.lg-success {
  color: #147a3f;
  font-size: 0.92rem;
  margin: 12px 0 0;
}
.lg-plan-name {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0;
  margin-top: 12px;
}
.lg-plan-card strong {
  display: block;
  font-size: 1.6rem;
  margin-top: 14px;
}
.lg-plan-card p {
  color: #666;
  margin: 8px 0 0;
}
.lg-usage-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lg-usage__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.lg-usage__bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #efeee8;
}
.lg-usage__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2495de;
}
.lg-map-panel {
  border: 1px solid #ecece6;
  border-radius: 8px;
  padding: 14px;
  background: #fbfbf8;
}
.lg-map-panel h4 {
  margin: 0;
  font-size: 0.95rem;
}
.lg-map-select {
  width: 100%;
  min-width: 160px;
  padding: 7px 9px;
  border: 1px solid #d4d4d0;
  border-radius: 7px;
  background: #fff;
  font: inherit;
}

@media (max-width: 780px) {
  .lg-stat-grid,
  .lg-billing-grid,
  .lg-settings-grid,
  .lg-plan-grid {
    grid-template-columns: 1fr;
  }
  .lg-search input { width: min(100%, 220px); }
}

/* Settings page — scoped to body.settings-shell */
.settings-shell {
  min-height: 100vh;
  background: #f7f7f3;
  color: #181818;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

.settings-shell .appbar {
  background: rgba(247, 247, 243, 0.94);
}

.settings-page {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  width: min(100%, 1240px);
  min-height: calc(100vh - 73px);
  margin: 0 auto;
  border-inline: 1px solid #e4e1da;
  background: #fbfaf7;
}

.settings-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: calc(100vh - 73px);
  padding: 14px 16px 28px;
  border-right: 1px solid #e4e1da;
  background: #f3f2ed;
}

.settings-search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #dedbd4;
  border-radius: 8px;
  background: #fff;
  color: #77736b;
}

.settings-search svg,
.settings-nav__item svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #1f1f1d;
  font-size: 15px;
}

.settings-search input::placeholder {
  color: #817d75;
}

.settings-sidebar__label {
  margin: 28px 10px 10px;
  color: #77736b;
  font-size: 13px;
  font-weight: 500;
}

.settings-nav {
  display: grid;
  gap: 4px;
}

.settings-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 8px 11px;
  border-radius: 8px;
  color: #56524b;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.settings-nav__item:hover {
  background: #ebe9e2;
  color: #191917;
  text-decoration: none;
}

.settings-nav__item.is-active {
  background: #dfddd6;
  color: #151513;
  font-weight: 700;
}

.settings-content {
  min-width: 0;
  padding: 48px clamp(28px, 5vw, 72px) 88px;
  background: #fff;
}

.settings-form {
  max-width: 900px;
}

.settings-section {
  scroll-margin-top: 28px;
  padding-bottom: 34px;
  margin-bottom: 34px;
  border-bottom: 1px solid #ece9e3;
}

.settings-section:last-of-type {
  border-bottom: 0;
}

.settings-section__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.settings-section__head .eyebrow {
  margin: 0 0 8px;
  color: #827d74;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-section__head h1,
.settings-section__head h2 {
  margin: 0;
  color: #171716;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.settings-section__head p {
  max-width: 620px;
  margin: 8px 0 0;
  color: #77736b;
  font-size: 14px;
  line-height: 1.5;
}

.settings-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid rgba(20, 122, 63, 0.18);
  border-radius: 999px;
  background: rgba(20, 122, 63, 0.08);
  color: #147a3f;
  font-size: 13px;
  font-weight: 700;
}

.settings-rows {
  border-top: 1px solid #eeeeea;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 280px);
  align-items: center;
  gap: 28px;
  min-height: 72px;
  padding: 15px 0;
  border-bottom: 1px solid #eeeeea;
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row h2,
.settings-row strong {
  display: block;
  margin: 0;
  color: #1c1b19;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.settings-row p,
.settings-row em {
  display: block;
  margin: 5px 0 0;
  color: #817d75;
  font-size: 13px;
  font-style: normal;
  line-height: 1.45;
}

.settings-row input:not([type="checkbox"]),
.settings-row select {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid #ddd9d1;
  border-radius: 8px;
  background: #fff;
  color: #191917;
  font: inherit;
}

.settings-row input:not([type="checkbox"]):focus,
.settings-row select:focus {
  border-color: #0875d1;
  outline: 2px solid rgba(8, 117, 209, 0.14);
  outline-offset: 1px;
}

.settings-row output {
  min-width: 0;
  overflow: hidden;
  color: #35322d;
  font-size: 14px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row--avatar {
  align-items: center;
}

.settings-avatar-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.settings-avatar {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ebe9e2;
  color: #191917;
  font-size: 15px;
  font-weight: 800;
}

.settings-row--toggle input[type="checkbox"] {
  justify-self: end;
  width: 20px;
  height: 20px;
  accent-color: #0875d1;
}

.settings-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.settings-metric {
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid #e7e3dc;
  border-radius: 8px;
  background: #fbfaf7;
}

.settings-metric span {
  display: block;
  color: #827d74;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-metric strong {
  display: block;
  margin-top: 8px;
  color: #151513;
  font-size: 24px;
  line-height: 1;
}

.settings-alert {
  margin: 0 0 16px;
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 14px;
}

.settings-alert--error {
  border: 1px solid rgba(176, 0, 32, 0.18);
  background: rgba(176, 0, 32, 0.07);
  color: #9e001c;
}

.settings-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 16px 0 0;
  border-top: 1px solid #ece9e3;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), #fff 42%);
}

.settings-footer strong,
.settings-footer span {
  display: block;
}

.settings-footer strong {
  color: #1c1b19;
  font-size: 14px;
}

.settings-footer span {
  margin-top: 2px;
  color: #817d75;
  font-size: 13px;
}

@media (max-width: 860px) {
  .settings-page {
    display: block;
    border-inline: 0;
  }

  .settings-sidebar {
    position: relative;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid #e4e1da;
  }

  .settings-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .settings-nav__item {
    white-space: nowrap;
  }

  .settings-content {
    padding: 34px 20px 72px;
  }

  .settings-row {
    grid-template-columns: 1fr;
    gap: 11px;
    align-items: stretch;
  }

  .settings-row output {
    text-align: left;
  }

  .settings-row--toggle {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .settings-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .settings-avatar-field {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .settings-footer,
  .settings-section__head {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-metrics {
    grid-template-columns: 1fr;
  }

  .settings-footer .btn {
    width: 100%;
  }
}
