:root {
  --ink: #14202b;
  --muted: #657384;
  --line: #d8e1ea;
  --soft: #f5f8fb;
  --surface: #ffffff;
  --brand: #2364aa;
  --green: #2f8f6d;
  --yellow: #b86b18;
  --red: #b73a3a;
  --shadow: 0 14px 36px rgba(31, 47, 64, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(35, 100, 170, 0.08), transparent 260px),
    #f7f9fc;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

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

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(216, 225, 234, 0.88);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--green));
  color: #fff;
  font-weight: 800;
}

.brand h1,
.brand p,
.panel h2,
.panel h3,
.workspace h2,
.workspace p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p,
.muted,
.workspace p,
.panel p {
  color: var(--muted);
  font-size: 13px;
}

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

.session span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.page {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 32px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  gap: 24px;
}

.login-panel {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.login-panel h2 {
  font-size: 25px;
}

.auth-tabs,
.role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.auth-tabs button,
.role-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.auth-tabs button.active,
.role-tabs button.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 3px 10px rgba(28, 42, 56, 0.08);
}

.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.visual-panel {
  overflow: hidden;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.visual-scene {
  position: relative;
  min-height: 360px;
  background:
    radial-gradient(circle at 20% 30%, rgba(47, 143, 109, 0.22), transparent 26%),
    linear-gradient(135deg, #edf5ff, #fff 45%, #eef8f0);
}

.board {
  position: absolute;
  inset: 44px 48px 36px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
  border: 2px solid rgba(35, 100, 170, 0.3);
  border-radius: var(--radius);
}

.board div {
  border-radius: 6px;
  background: rgba(35, 100, 170, 0.12);
  border: 1px solid rgba(35, 100, 170, 0.24);
}

.floating-card {
  position: absolute;
  right: 30px;
  bottom: 28px;
  display: grid;
  gap: 8px;
  width: min(330px, calc(100% - 60px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.floating-card strong {
  font-size: 22px;
}

.floating-card span {
  color: var(--muted);
}

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

.controls {
  display: grid;
  grid-template-columns: 210px 1.3fr 280px auto;
  align-items: end;
  gap: 8px;
  padding: 8px 10px;
}

.controls label,
.controls input,
.controls select,
.controls button {
  font-size: 18px;
}

.date-control {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 6px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.stat {
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.stat strong {
  display: block;
  font-size: 18px;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 18px;
}

.lesson-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto auto;
  gap: 12px;
  align-items: end;
}

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

.coach-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.coach-profile {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 12px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--green));
  color: #fff;
  font-weight: 800;
}

.coach-name {
  margin: 0;
  font-size: 17px;
}

.coach-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.schedule-panel {
  padding: 0;
  overflow: hidden;
}

.schedule-board {
  overflow-x: auto;
}

.coach-week {
  min-width: 760px;
  border-bottom: 1px solid var(--line);
}

.coach-week:last-child {
  border-bottom: 0;
}

.coach-cell {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 6px;
  align-items: center;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.coach-cell .avatar {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

.coach-label {
  display: grid;
  gap: 2px;
}

.coach-label strong {
  font-size: 18px;
}

.coach-label span {
  color: var(--muted);
  font-size: 18px;
}

.week-grid {
  display: grid;
}

.week-row {
  display: grid;
  grid-template-columns: 64px repeat(7, minmax(92px, 1fr));
  min-height: 30px;
}

.week-head {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.time-cell,
.day-cell {
  min-height: 24px;
  padding: 2px 6px;
  border-right: 1px solid #eef2f6;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.time-cell {
  display: grid;
  place-items: center;
  border-left: 0;
}

.day-cell {
  display: grid;
  place-items: center;
  gap: 2px;
  text-align: center;
}

.day-cell span {
  font-size: 18px;
  font-weight: 500;
}

.slot {
  min-width: 0;
  min-height: 30px;
  height: 100%;
  border-right: 1px solid #eef2f6;
  border-bottom: 1px solid #eef2f6;
  border-top: 0;
  border-left: 0;
  background: #fff;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  line-height: 18px;
  overflow: hidden;
}

.slot:last-child {
  border-right: 0;
}

.slot .slot-time {
  font-size: 14px;
  font-weight: 800;
}

.slot .slot-label {
  font-size: 18px;
  line-height: 18px;
  color: var(--muted);
}

.slot .slot-person {
  max-width: 100%;
  overflow: hidden;
  color: #14202b;
  font-size: 18px;
  font-weight: 700;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot.open {
  background: #eefaf5;
  border: 1px solid #a9e2cb;
  color: var(--ink);
}

.slot.mine {
  background: #fff2df;
  border: 1px solid #efbb77;
  color: var(--ink);
}

.slot.booked {
  background: #fff2df;
  border: 1px solid #efbb77;
  color: var(--ink);
}

.slot.closed {
  background: #f1f4f7;
  color: #85909a;
  border: 1px solid #d8e1ea;
}

.slot.empty {
  background: #eefaf5;
  border: 1px dashed #a9e2cb;
  color: var(--ink);
}

.slot.createable {
  cursor: pointer;
}

.slot.createable:hover {
  border-color: #2364aa;
  box-shadow: inset 0 0 0 1px rgba(35, 100, 170, 0.08);
}

.week-row .slot:not(.open):not(.mine):not(.booked):not(.closed):not(.empty):nth-child(odd) {
  background: #fcfdff;
}

.ghost {
  background: #fff;
  border-color: var(--line);
}

.danger {
  color: var(--red);
  background: #fff5f5;
  border-color: #efc1c1;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.toast {
  position: fixed;
  top: 86px;
  left: 50%;
  z-index: 30;
  display: none;
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  min-height: 44px;
  padding: 11px 20px;
  border-radius: var(--radius);
  background: #e8f7ef;
  color: #176b4f;
  font-size: 19px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 22px rgba(31, 47, 64, 0.16);
  transform: translateX(-50%);
}

.toast.show {
  display: block;
}

.toast.error {
  background: #fff0f0;
  color: var(--red);
}

.toast.info {
  background: #eef4fb;
  color: var(--brand);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 32, 43, 0.36);
}

.modal-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-card h3,
.modal-card p {
  margin: 0;
}

.modal-card h3 {
  font-size: 18px;
}

.modal-card p {
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-line;
}

.modal-field {
  display: grid;
  gap: 8px;
}

.modal-field span {
  color: var(--muted);
  font-size: 13px;
}

.modal-field small {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 900px) {
  .login-grid,
  .controls,
  .lesson-form,
  .coach-card {
    grid-template-columns: 1fr;
  }

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

  .coach-week {
    min-width: 620px;
  }

  .week-row {
    grid-template-columns: 56px repeat(7, minmax(78px, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .page {
    width: calc(100% - 20px);
    padding-top: 14px;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .session {
    flex-wrap: wrap;
  }

  .slot {
    min-height: 34px;
  }

  .time-cell,
  .day-cell {
    min-height: 34px;
  }
}
