:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0f2233;
  background: #f6f8fa;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button, a { cursor: pointer; }
a { text-decoration: none; }

.app-shell { min-height: 100vh; padding: 22px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  max-width: 1280px; margin: 0 auto 18px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.1; }
.topbar p { margin-top: 6px; color: #5c6a75; font-size: 15px; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.admin-indicator {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px;
  border-radius: 8px; color: #0d4d32; background: #e8f5ee; border: 1px solid #bfe1d1;
  font-size: 13px; font-weight: 900;
}

.primary-button, .ghost-button, .danger-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; border-radius: 8px; padding: 0 14px; border: 1px solid transparent;
  font-size: 14px; font-weight: 800; white-space: nowrap;
}
.primary-button { background: #167348; color: white; box-shadow: 0 6px 16px rgba(22, 115, 72, .18); }
.ghost-button { background: white; color: #173044; border-color: #d6dee5; }
.ghost-button:disabled { color: #9aa6af; cursor: not-allowed; background: #f3f6f8; }
.danger-button { color: #a6332b; background: #fff5f3; border-color: #f0c8c1; }

.layout { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; }
.booking-area, .organizer-panel {
  background: white; border: 1px solid #dce3e9; border-radius: 8px;
  box-shadow: 0 16px 34px rgba(16, 32, 46, .07);
}
.booking-area { overflow: hidden; }
.week-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px; border-bottom: 1px solid #e4eaf0; background: #fbfcfd;
}
.label { display: block; margin-bottom: 5px; color: #677782; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.week-strip strong { font-size: 20px; }
.copy-state { color: #167348; font-size: 14px; font-weight: 800; text-align: right; }

.booking-form {
  display: grid; grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) minmax(220px, 1.35fr) auto auto;
  gap: 12px; align-items: end; padding: 18px 20px; border-bottom: 1px solid #e4eaf0;
}
.field label { display: block; margin-bottom: 7px; color: #40515e; font-size: 13px; font-weight: 800; }
.field input {
  width: 100%; height: 42px; border: 1px solid #cfd9e1; border-radius: 8px;
  padding: 0 12px; color: #0f2233; background: #fff; outline: none;
}
.field input:focus { border-color: #167348; box-shadow: 0 0 0 3px rgba(22, 115, 72, .12); }
.selected-summary {
  min-height: 42px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center;
  padding: 8px 11px; border: 1px solid #dce3e9; border-radius: 8px; background: #f6f9f8;
}
.selected-summary span { color: #167348; font-weight: 900; }
.selected-summary strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.notice { margin: 14px 20px 0; padding: 11px 12px; color: #0d4d32; border: 1px solid #bfe1d1; background: #effaf4; border-radius: 8px; font-size: 14px; font-weight: 800; }
.notice.error { color: #9a352d; border-color: #e3c8c2; background: #fff8f6; }
.slot-list { padding: 12px; }
.slot-row {
  display: grid; grid-template-columns: 245px 112px minmax(220px, 1fr); align-items: stretch;
  min-height: 76px; border: 1px solid #e1e7ec; border-radius: 8px; margin-bottom: 8px; background: #fff;
}
.slot-row.selected { border-color: #167348; box-shadow: 0 0 0 3px rgba(22, 115, 72, .10); }
.slot-row.blocked { background: #f8f9fa; border-color: #d9dee3; }
.slot-main {
  display: grid; grid-template-columns: 28px 58px 1fr; grid-template-rows: 1fr 1fr; gap: 3px 10px;
  align-items: center; padding: 14px; text-align: left; color: inherit;
}
.slot-main input { grid-row: 1 / span 2; width: 18px; height: 18px; accent-color: #167348; }
.time { grid-row: 1 / span 2; font-size: 18px; font-weight: 900; color: #122b3f; }
.type { font-size: 14px; font-weight: 900; }
.type.training { color: #167348; }
.type.play { color: #1c5c8b; }
.type.lights { color: #946200; }
.court { color: #667682; font-size: 13px; font-weight: 700; }
.capacity {
  display: grid; justify-content: center; align-content: center; border-left: 1px solid #edf1f4; border-right: 1px solid #edf1f4; color: #50606b;
}
.capacity span { font-weight: 900; }
.capacity small { margin-top: 4px; text-align: center; color: #75828c; font-size: 12px; font-weight: 800; }
.names { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px; }
.empty { color: #84909a; font-size: 14px; }
.name-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; border: 1px solid #d7e0e6;
  border-radius: 8px; padding: 0 10px; background: #f9fbfc; color: #172d3f; font-size: 13px; font-weight: 800;
}
.inline-form { display: inline; margin: 0; }
.block-button {
  display: inline-flex; align-items: center; min-height: 32px; border: 1px solid #e3c8c2; border-radius: 8px;
  padding: 0 10px; background: #fff8f6; color: #9a352d; font-size: 13px; font-weight: 900;
}
.mini-danger {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #e3c8c2;
  border-radius: 7px;
  padding: 0 8px;
  background: #fff8f6;
  color: #9a352d;
  font-size: 12px;
  font-weight: 900;
}
.organizer-panel { align-self: start; padding: 18px; position: sticky; top: 18px; }
.panel-section { display: flex; gap: 12px; padding-bottom: 17px; margin-bottom: 17px; border-bottom: 1px solid #e4eaf0; }
.panel-section:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.panel-section h2 { font-size: 18px; }
.panel-section h3 { font-size: 15px; margin-bottom: 6px; }
.panel-section p { color: #64737f; font-size: 14px; line-height: 1.45; }
.panel-stack { display: block; }
.panel-stack button, .panel-stack a { margin-top: 12px; }
.full { width: 100%; }
.admin-panel { background: #fbfcfd; margin-left: -8px; margin-right: -8px; padding: 12px 8px 17px; border-radius: 8px; }
.copy-field {
  width: 100%;
  height: 38px;
  margin-top: 10px;
  border: 1px solid #cfd9e1;
  border-radius: 8px;
  padding: 0 10px;
  color: #40515e;
  background: white;
  font-size: 12px;
}
.slot-editor { margin-top: 10px; }
.slot-editor-row {
  display: grid;
  grid-template-columns: 62px 1fr 76px 54px 50px;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.slot-editor-row input {
  min-width: 0;
  height: 34px;
  border: 1px solid #cfd9e1;
  border-radius: 6px;
  padding: 0 7px;
  color: #0f2233;
  background: white;
  font-size: 12px;
}
.slot-editor-row.new {
  padding-top: 8px;
  border-top: 1px solid #e4eaf0;
}
.delete-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #64737f;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 1040px) {
  .layout { grid-template-columns: 1fr; }
  .organizer-panel { position: static; }
}
@media (max-width: 820px) {
  .app-shell { padding: 10px; }
  .topbar, .week-strip { align-items: stretch; flex-direction: column; }
  .top-actions, .top-actions button { width: 100%; }
  .booking-form { grid-template-columns: 1fr; }
  .submit-button, .danger-button { width: 100%; }
  .slot-row { grid-template-columns: 1fr; }
  .capacity { justify-content: start; padding: 0 14px 10px; border: 0; }
  .names { padding-top: 0; }
  .slot-editor-row { grid-template-columns: 1fr 1fr; }
}
