:root {
  color-scheme: light;
  --ink: #19212a;
  --muted: #5f6b76;
  --line: #d8e1e8;
  --panel: #ffffff;
  --page: #edf3f5;
  --green: #0f8a5f;
  --green-dark: #0b6148;
  --mint: #dff4eb;
  --blue: #1f5f9d;
  --sky: #e3f1fb;
  --gold: #ba7a13;
  --gold-soft: #fff0cf;
  --coral: #d85a48;
  --coral-soft: #fee6df;
  --shadow: 0 18px 45px rgba(26, 46, 58, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 138, 95, 0.08), transparent 36%),
    linear-gradient(220deg, rgba(31, 95, 157, 0.1), transparent 42%),
    var(--page);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  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(1.35rem, 2.4vw, 2.2rem);
  line-height: 1.05;
}

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

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

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  background: white;
  font-size: 0.9rem;
  font-weight: 850;
  text-decoration: none;
}

.nav-link:hover {
  border-color: rgba(15, 138, 95, 0.35);
  background: var(--mint);
}

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

.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 95, 157, 0.12);
}

.compact-field {
  width: 170px;
}

.booking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.schedule-panel,
.booking-panel {
  display: grid;
  gap: 16px;
}

.schedule-panel,
.booking-panel .panel-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.schedule-panel {
  padding: 16px;
}

.panel-section {
  padding: 16px;
}

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

.panel-heading.tight {
  gap: 10px;
}

.panel-heading svg,
.panel-heading i {
  width: 22px;
  height: 22px;
  color: var(--green);
}

.schedule-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

.icon-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.icon-button:disabled {
  cursor: not-allowed;
  color: #9aa6af;
  background: #eef3f5;
}

.icon-button:disabled:hover {
  border-color: var(--line);
  color: #9aa6af;
}

.icon-glyph {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.stats-row > div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.stats-row span {
  display: block;
  font-size: 1.45rem;
  font-weight: 850;
}

.stats-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.schedule-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.schedule-grid {
  display: grid;
  grid-template-columns: 88px repeat(6, minmax(118px, 1fr));
  min-width: 860px;
}

.time-cell,
.court-cell,
.slot-button {
  min-height: 58px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.time-cell,
.court-cell {
  display: grid;
  align-items: center;
  padding: 10px 12px;
  background: #f8fbfc;
  font-weight: 800;
}

.time-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  color: var(--muted);
  font-size: 0.86rem;
}

.court-cell {
  min-height: 48px;
  justify-items: start;
}

.slot-button {
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 9px 10px;
  color: var(--ink);
  background: white;
  text-align: left;
  transition:
    transform 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.slot-button:hover:not(:disabled) {
  background: #f1faf6;
  box-shadow: inset 0 0 0 2px rgba(15, 138, 95, 0.22);
}

.slot-button.is-selected {
  color: white;
  background: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.26);
}

.slot-button.is-booked {
  color: #8f2f25;
  background: var(--coral-soft);
}

.slot-button.is-maintenance {
  color: #755006;
  background: var(--gold-soft);
}

.slot-button.is-training {
  color: #1f4f7a;
  background: #dcecff;
}

.slot-button:disabled {
  cursor: not-allowed;
}

.slot-title {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 850;
}

.slot-meta {
  overflow-wrap: anywhere;
  color: currentColor;
  font-size: 0.76rem;
  opacity: 0.78;
}

.booking-panel {
  position: sticky;
  top: 16px;
}

.reservation-card {
  display: grid;
  gap: 16px;
}

.selected-slot {
  min-height: 74px;
  padding: 13px;
  border: 1px solid rgba(31, 95, 157, 0.22);
  border-radius: 8px;
  background: var(--sky);
}

.selected-slot p {
  margin-bottom: 5px;
  font-weight: 850;
}

.selected-slot span {
  color: var(--muted);
  font-size: 0.88rem;
}

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

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.price-row span {
  color: var(--muted);
  font-weight: 750;
}

.price-row strong {
  font-size: 1.55rem;
}

.form-message {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--coral);
  font-size: 0.86rem;
  font-weight: 750;
}

.form-message.is-success {
  color: var(--green-dark);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--green);
  font-weight: 850;
}

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

.booking-count {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--blue);
  font-size: 0.86rem;
  font-weight: 850;
}

.booking-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.booking-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.booking-item strong,
.booking-item span {
  overflow-wrap: anywhere;
}

.booking-item strong {
  font-size: 0.95rem;
}

.booking-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.booking-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.booking-item-footer button {
  border: 0;
  color: var(--coral);
  background: transparent;
  font-weight: 800;
}

.empty-state {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfe;
  font-size: 0.9rem;
}

.admin-layout {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 16px;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(160px, 220px)) auto;
  gap: 12px;
  align-items: end;
}

.training-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr)) minmax(160px, auto);
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.training-block-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.secondary-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  font-weight: 850;
}

.secondary-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.admin-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

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

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  background: #f8fbfc;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-table td {
  font-size: 0.9rem;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--mint);
  font-size: 0.78rem;
  font-weight: 850;
}

.danger-button {
  min-height: 32px;
  border: 0;
  color: var(--coral);
  background: transparent;
  font-weight: 850;
}

.is-hidden {
  display: none !important;
}

.login-layout {
  display: grid;
  min-height: calc(100vh - 140px);
  align-items: center;
  justify-items: center;
  margin-top: 16px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
}

.login-form {
  display: grid;
  gap: 14px;
}

@media (max-width: 1180px) {
  .booking-layout {
    grid-template-columns: 1fr;
  }

  .booking-panel {
    grid-column: 1 / -1;
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

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

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

  .compact-field {
    width: auto;
  }

  .booking-layout {
    grid-template-columns: 1fr;
  }

  .booking-panel {
    position: static;
  }

  .booking-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar-actions,
  .stats-row,
  .form-grid,
  .admin-filters,
  .training-form {
    grid-template-columns: 1fr;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

}
