:root {
  --ink: #17212b;
  --muted: #617083;
  --line: #d9e0e8;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --nav: #101821;
  --green: #6d35d6;
  --green-dark: #4d22a8;
  --red: #c94f3d;
  --gold: #c48b2c;
  --blue: #2867b2;
  --shadow: 0 18px 45px rgba(26, 37, 52, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button:disabled,
input:disabled,
select:disabled {
  cursor: wait;
  opacity: 0.68;
}

[hidden] {
  display: none !important;
}

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

.auth-screen {
  min-height: 100vh;
  display: grid;
  gap: 12px;
  align-content: center;
  justify-items: center;
  padding: 12px 20px;
  background:
    linear-gradient(90deg, rgba(16, 24, 33, 0.9), rgba(40, 103, 178, 0.66)),
    url("https://source.unsplash.com/jFsI671sWDU/1600x1000");
  background-position: center;
  background-size: cover;
}

.auth-brand,
.auth-card {
  width: min(440px, 100%);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
}

.auth-brand .brand-logo {
  width: 44px;
  height: 44px;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand span {
  color: #d5e0eb;
  font-size: 0.86rem;
}

.auth-card {
  display: grid;
  gap: 11px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.auth-card h1 {
  font-size: clamp(2rem, 8vw, 2.75rem);
}

.auth-card p {
  margin-bottom: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-card label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.auth-alert {
  padding: 12px;
  color: var(--ink);
  border: 1px solid #bfd4ef;
  border-radius: 8px;
  background: #eef6ff;
  line-height: 1.4;
}

.auth-alert[data-tone="error"] {
  color: #7b2519;
  border-color: #efc3ba;
  background: #fff0ed;
}

.auth-alert[data-tone="success"] {
  color: #23523e;
  border-color: #b8dccb;
  background: #edf9f3;
}

.auth-actions {
  display: grid;
  gap: 10px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px;
  color: #f7fafc;
  background: var(--nav);
}

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

.brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
}

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

.brand span {
  color: #a9b8c9;
  font-size: 0.82rem;
}

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

.nav-tab {
  width: 100%;
  padding: 12px 14px;
  color: #d7e2ed;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.nav-tab:hover,
.nav-tab.active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-card p {
  margin: 8px 0 0;
  color: #b8c5d4;
  line-height: 1.45;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow,
.label {
  color: var(--green-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}

.top-actions,
.panel-header,
.call-card,
.video-card,
.plan-item {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 10px;
}

.user-chip {
  max-width: 260px;
  overflow: hidden;
  padding: 10px 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.primary-action,
.secondary-action {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--panel);
}

.primary-action {
  padding: 0 18px;
  color: #ffffff;
  background: var(--green);
  font-weight: 750;
}

.primary-action:hover {
  background: var(--green-dark);
}

.secondary-action {
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #ffffff;
  font-weight: 700;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 20px;
}

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

.metric,
.panel,
.athlete-hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 2px;
  font-size: 2rem;
}

.coach-layout,
.training-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.75fr);
  gap: 20px;
}

.panel,
.athlete-hero {
  padding: 22px;
}

.panel-header {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.athlete-profile {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.profile-stat {
  padding: 14px;
  border-radius: 8px;
  background: #f2f6f6;
}

.profile-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 1.15rem;
}

.chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  align-items: end;
  gap: 12px;
  height: 240px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.bar {
  display: grid;
  align-content: end;
  gap: 8px;
  height: 100%;
}

.bar-fill {
  min-height: 28px;
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, var(--green), var(--blue));
}

.bar-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.video-list,
.plan-list,
.call-grid,
.drill-grid,
.setup-grid,
.rubric-grid,
.form-preview,
.screen-list,
.template-grid,
.report-sections,
.philosophy-grid {
  display: grid;
  gap: 12px;
}

.video-card,
.plan-item,
.call-card {
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.video-card strong,
.plan-item strong,
.call-card strong {
  display: block;
}

.video-card span,
.plan-item span,
.call-card span,
.drill-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.status {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: #ffffff;
  border-radius: 8px;
  background: var(--blue);
  font-size: 0.75rem;
  font-weight: 800;
}

.status.urgent {
  background: var(--red);
}

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

.athlete-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background:
    linear-gradient(90deg, rgba(16, 24, 33, 0.88), rgba(15, 138, 115, 0.62)),
    url("https://images.unsplash.com/photo-1562771379-eafdca7a02f8?auto=format&fit=crop&w=1600&q=80");
  background-position: center;
  background-size: cover;
  color: #ffffff;
}

.athlete-hero .eyebrow {
  color: #b9f3e7;
}

.athlete-hero h2 {
  max-width: 760px;
  font-size: clamp(1.45rem, 3vw, 2.6rem);
  line-height: 1.1;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented button {
  min-width: 68px;
  min-height: 36px;
  border: 0;
  background: #fff;
  cursor: pointer;
}

.segmented button.active {
  color: #fff;
  background: var(--ink);
}

.plan-item {
  align-items: flex-start;
}

.plan-item time {
  flex: 0 0 72px;
  color: var(--green-dark);
  font-weight: 850;
}

.upload-panel label {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

.upload-zone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 170px;
  padding: 18px;
  border: 2px dashed #9cb4c3;
  border-radius: 8px;
  background: #f3f8fa;
  text-align: center;
}

.upload-zone input {
  max-width: 100%;
  min-height: auto;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.instruction-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.instruction-list div,
.screen-item,
.rubric-card,
.template-card,
.field-preview,
.philosophy-grid article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.instruction-list strong,
.instruction-list span,
.screen-item strong,
.screen-item span,
.template-card strong,
.template-card span,
.field-preview span {
  display: block;
}

.instruction-list span,
.screen-item span,
.template-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

textarea {
  min-height: 110px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.full {
  width: 100%;
  margin-top: 14px;
}

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

.drill-card,
.setup-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.drill-tag {
  display: inline-block;
  margin-bottom: 16px;
  padding: 5px 8px;
  color: #ffffff;
  border-radius: 8px;
  background: var(--gold);
  font-size: 0.72rem;
  font-weight: 850;
}

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

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

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

.rubric-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.rubric-card strong {
  display: block;
}

.rubric-card span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.score-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
  color: #fff;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.field-preview {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.field-preview input::placeholder {
  color: #7c8998;
  opacity: 1;
}

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

.template-card {
  display: grid;
  gap: 14px;
}

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

.before-after article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.before-after span {
  color: var(--green-dark);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.before-after strong {
  display: block;
  margin: 6px 0;
  font-size: 2rem;
}

.before-after p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.report-meter {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-weight: 800;
}

.report-meter div {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.report-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--ink));
}

.philosophy-panel h2 {
  max-width: 760px;
  margin: 6px 0 18px;
  font-size: clamp(1.5rem, 3vw, 2.7rem);
  line-height: 1.08;
}

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

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

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

.modal-panel {
  width: min(620px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.modal-fields {
  display: grid;
  gap: 12px;
}

@media (max-width: 1040px) {
  .app-shell,
  .coach-layout,
  .training-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metric-grid,
  .call-grid,
  .drill-grid,
  .template-grid,
  .philosophy-grid,
  .rubric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .topbar,
  .athlete-hero,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-tabs,
  .metric-grid,
  .athlete-profile,
  .call-grid,
  .drill-grid,
  .setup-grid,
  .template-grid,
  .philosophy-grid,
  .rubric-grid,
  .before-after {
    grid-template-columns: 1fr;
  }

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

  .user-chip {
    max-width: none;
    width: 100%;
  }
}
