:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --line: #e2e5e9;
  --line-strong: #cdd3da;
  --text: #101418;
  --muted: #69727d;
  --black: #0d1117;
  --green: #168a46;
  --green-soft: #e7f4ec;
  --blue: #1569b7;
  --blue-soft: #e7f0fb;
  --amber: #d99200;
  --amber-soft: #fff4d8;
  --red: #d43f3a;
  --red-soft: #fdebea;
  --gray-soft: #eef1f4;
  --radius: 8px;
  --shadow: 0 18px 45px rgba(13, 17, 23, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(226, 229, 233, 0.42) 1px, transparent 1px),
    linear-gradient(rgba(226, 229, 233, 0.28) 1px, transparent 1px), var(--bg);
  background-size: 96px 96px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-brand {
  justify-content: space-between;
}

.login-card h2 {
  margin: 0;
  font-size: 30px;
}

.login-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-form,
.login-demo {
  display: grid;
  gap: 12px;
}

.login-demo {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.auth-pill--live {
  background: rgba(22, 138, 70, 0.12);
  color: #168a46;
  border: 1px solid rgba(22, 138, 70, 0.3);
}

.auth-pill--demo {
  background: rgba(217, 146, 0, 0.12);
  color: #b06a00;
  border: 1px solid rgba(217, 146, 0, 0.3);
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mode-chip--live {
  background: rgba(22, 138, 70, 0.12);
  color: #168a46;
  border: 1px solid rgba(22, 138, 70, 0.3);
}

.mode-chip--demo {
  background: rgba(105, 114, 125, 0.12);
  color: #69727d;
  border: 1px solid rgba(105, 114, 125, 0.3);
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sync-pill--idle {
  background: rgba(105, 114, 125, 0.1);
  color: #69727d;
}

.sync-pill--loading {
  background: rgba(21, 105, 183, 0.12);
  color: #1569b7;
}

.sync-pill--ready {
  background: rgba(22, 138, 70, 0.12);
  color: #168a46;
}

.sync-pill--error {
  background: rgba(198, 40, 40, 0.12);
  color: #c62828;
}

button,
input,
select,
textarea {
  font: inherit;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 20px;
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  background: var(--surface);
}

.club-select,
.role-panel,
.week-panel,
.quick-actions {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
}

.club-select {
  display: grid;
  gap: 8px;
  padding: 14px;
}

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

.select-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-row svg {
  width: 17px;
  height: 17px;
  color: var(--text);
  flex: 0 0 auto;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 11px;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(21, 105, 183, 0.12);
}

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

.nav-button,
.top-tab,
.icon-button,
.secondary-button,
.primary-button,
.ghost-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.nav-button {
  justify-content: flex-start;
  width: 100%;
  padding: 0 12px;
  color: #3a424c;
}

.nav-button svg,
.top-tab svg,
.icon-button svg,
.primary-button svg,
.secondary-button svg,
.ghost-button svg,
.link-button svg,
.icon-glyph {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.icon-glyph {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: currentColor;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.nav-button.active {
  background: var(--black);
  color: #fff;
  box-shadow: 0 12px 28px rgba(13, 17, 23, 0.16);
}

.nav-button:hover:not(.active),
.top-tab:hover:not(.active),
.ghost-button:hover,
.secondary-button:hover,
.link-button:hover {
  background: var(--surface-soft);
}

.role-panel {
  padding: 14px;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.role-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
}

.role-button.active {
  border-color: var(--black);
  color: var(--text);
  background: var(--gray-soft);
}

.week-panel {
  margin-top: auto;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.week-header,
.page-head,
.panel-header,
.topbar,
.profile,
.head-actions,
.button-row,
.inline-actions,
.stat-row,
.player-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.week-header,
.page-head,
.panel-header,
.stat-row,
.player-top {
  justify-content: space-between;
}

.week-header strong {
  font-size: 14px;
}

.week-arrows {
  display: inline-flex;
  gap: 6px;
}

.tiny-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.context-list {
  display: grid;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.context-list p {
  margin: 4px 0 0;
  line-height: 1.35;
}

.quick-actions {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 74px;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.top-tabs {
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-tabs::-webkit-scrollbar {
  display: none;
}

.top-tab {
  position: relative;
  min-height: 74px;
  padding: 0 6px;
  border-radius: 0;
  color: #4c5561;
}

.top-tab.active {
  color: var(--text);
}

.top-tab.active::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 0;
  height: 3px;
  background: var(--black);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 18px;
}

.season-select {
  width: 150px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-color: var(--line);
  background: var(--surface);
}

.profile {
  min-width: 156px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--black);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.profile strong,
.profile span {
  display: block;
}

.profile strong {
  font-size: 14px;
}

.profile span {
  color: var(--muted);
  font-size: 12px;
}

.content {
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: 26px;
}

.page-head {
  align-items: flex-start;
  margin-bottom: 18px;
}

.page-head h2,
.panel h3,
.modal-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.page-head h2 {
  font-size: 28px;
  line-height: 1.08;
}

.page-head p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.head-actions,
.button-row,
.inline-actions {
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.link-button {
  padding: 0 14px;
}

.primary-button {
  border-color: var(--black);
  color: #fff;
  background: var(--black);
}

.primary-button:hover {
  background: #242b33;
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
}

.ghost-button {
  border-color: transparent;
}

.link-button {
  padding-inline: 0;
  color: var(--text);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.metric-card {
  min-height: 172px;
  padding: 22px;
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 7px;
}

.metric-card:last-child {
  border-right: 0;
}

.metric-title {
  font-weight: 700;
}

.metric-value {
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.metric-sub {
  color: var(--muted);
  font-size: 13px;
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.metric-trend.good {
  color: var(--green);
}

.metric-trend.warn {
  color: var(--amber);
}

.metric-trend.bad {
  color: var(--red);
}

.sparkline {
  width: 100%;
  height: 48px;
  align-self: end;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(13, 17, 23, 0.02);
}

.panel.pad {
  padding: 18px;
}

.panel-header {
  padding: 18px 18px 0;
}

.panel-title-block {
  display: grid;
  gap: 5px;
}

.panel-title-block p,
.panel p.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.panel-body {
  padding: 18px;
}

.main-stack {
  display: grid;
  gap: 18px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.chart-wrap {
  min-height: 286px;
}

.chart {
  width: 100%;
  height: auto;
  min-height: 260px;
}

.chart text {
  fill: var(--muted);
  font-size: 12px;
}

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

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.program-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(82px, 1fr));
  gap: 8px;
}

.day-card {
  min-height: 164px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 13px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.day-card strong {
  font-size: 13px;
}

.day-card .session-name {
  color: var(--blue);
  font-weight: 700;
  line-height: 1.2;
}

.day-card.strength {
  background: linear-gradient(180deg, var(--green-soft), #fff);
}

.day-card.condition {
  background: linear-gradient(180deg, var(--blue-soft), #fff);
}

.day-card.speed {
  background: linear-gradient(180deg, var(--amber-soft), #fff);
}

.day-card.recovery {
  background: linear-gradient(180deg, var(--gray-soft), #fff);
}

.day-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.insight-list {
  display: grid;
  gap: 12px;
}

.insight {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.insight-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.insight.good .insight-icon {
  color: var(--green);
  background: var(--green-soft);
}

.insight.warn .insight-icon {
  color: var(--amber);
  background: var(--amber-soft);
}

.insight.bad .insight-icon {
  color: var(--red);
  background: var(--red-soft);
}

.insight strong {
  display: block;
  margin-bottom: 6px;
}

.insight p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

table.compact-table {
  min-width: 540px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #39424e;
  font-size: 12px;
  font-weight: 700;
}

td {
  font-size: 14px;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.status-pill,
.tag,
.delta,
.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.tag.green,
.status-pill.green,
.delta.good {
  color: var(--green);
  background: var(--green-soft);
  border-color: #cce8d6;
}

.tag.blue {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #cfe1f6;
}

.tag.amber,
.status-pill.amber,
.delta.warn {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #f4dd9e;
}

.tag.red,
.status-pill.red,
.delta.bad {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f5c9c7;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid .full {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.field span {
  color: #39424e;
  font-size: 13px;
  font-weight: 650;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.resource-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.resource-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.resource-card h3,
.resource-card h4 {
  margin: 0;
}

.resource-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.player-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px;
  display: grid;
  gap: 12px;
  text-align: left;
}

.player-card.active {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(13, 17, 23, 0.08);
}

.number {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  background: var(--black);
  font-weight: 700;
  font-size: 13px;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mini-metric {
  padding: 10px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.mini-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mini-metric strong {
  font-size: 18px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}

.donut {
  width: 176px;
  height: 176px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green) var(--value), var(--line) 0);
}

.donut-inner {
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: var(--surface);
  text-align: center;
  padding: 12px;
}

.donut-inner strong {
  font-size: 34px;
}

.stat-list {
  display: grid;
  gap: 12px;
}

.stat-row strong {
  font-size: 24px;
}

.session-list {
  display: grid;
  gap: 10px;
}

.session-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.session-date {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.session-date strong {
  color: var(--text);
  font-size: 16px;
}

.session-main {
  min-width: 0;
}

.session-main strong {
  display: block;
  margin-bottom: 5px;
}

.session-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
}

#toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: grid;
  gap: 10px;
}

.toast {
  width: min(360px, calc(100vw - 44px));
  padding: 13px 14px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--black);
  box-shadow: var(--shadow);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 17, 23, 0.32);
}

.modal-card {
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-body {
  padding: 18px;
}

.footer-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }

  .metric-card {
    border-bottom: 1px solid var(--line);
  }

  .dashboard-grid,
  .two-col,
  .builder-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 18px;
  }

  .top-tab {
    min-height: 42px;
  }

  .top-actions {
    margin-left: 0;
    justify-content: space-between;
  }

  .content {
    padding: 18px;
  }

  .page-head {
    display: grid;
  }

  .metric-grid,
  .three-col,
  .form-grid,
  .form-grid.three,
  .card-grid,
  .player-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    border-right: 0;
  }

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

  .session-row,
  .donut-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .top-actions,
  .head-actions,
  .button-row,
  .inline-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .link-button {
    width: 100%;
  }

  .program-week {
    grid-template-columns: 1fr;
  }
}
