:root {
  color-scheme: light;
  --ink: #2b2b2f;
  --muted: #77727a;
  --line: #e1e1e4;
  --soft-line: #eeeeef;
  --paper: #ffffff;
  --panel: #f8f8f9;
  --purple: #8c59bd;
  --purple-dark: #7648a7;
  --gray: #aaa9ad;
  --blue: #1c70b8;
  --red: #d21122;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.app {
  width: min(100%, 920px);
  margin: 0 auto;
  background: var(--paper);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 74px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.app-header h1 {
  margin: 0;
  color: #5c535b;
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--soft-line);
  background: var(--panel);
}

label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 10px 12px;
}

.week-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 72px;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: white;
}

.week-nav button {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
}

.week-nav span {
  color: var(--gray);
  font-size: 44px;
  font-weight: 300;
  line-height: 1;
}

.schedule-wrap {
  border-bottom: 1px solid var(--line);
}

.schedule-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.schedule {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: white;
}

.schedule caption {
  height: 42px;
  padding: 9px 0 0 84px;
  border-bottom: 1px solid var(--line);
  color: #4c4c50;
  font-size: 20px;
  font-weight: 500;
  text-align: left;
}

.schedule th,
.schedule td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: white;
}

.schedule th:first-child,
.schedule td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 84px;
  border-left: 0;
  background: white;
}

.schedule thead th {
  height: 78px;
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  vertical-align: middle;
}

.schedule thead th:first-child {
  z-index: 3;
}

.day-number {
  display: block;
  font-size: 24px;
  line-height: 1.15;
}

.day-week {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
}

.date-sat {
  color: var(--blue);
}

.date-sun {
  color: var(--red);
}

.time-cell {
  height: 58px;
  padding-left: 12px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  text-align: left;
  vertical-align: middle;
}

.slot-cell {
  height: 58px;
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.slot-choice {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--purple);
  font-size: 31px;
  font-weight: 800;
  line-height: 1;
}

.slot-choice:hover,
.slot-choice.selected {
  background: rgba(140, 89, 189, 0.12);
}

.slot-choice.disabled {
  color: var(--gray);
  cursor: default;
}

.selection-panel {
  display: block;
  padding: 18px;
  background: var(--panel);
}

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

.selection-panel h2 {
  margin: 0;
  font-size: 20px;
}

.secondary {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--purple);
  font-weight: 800;
}

.selection-panel label:has(textarea),
.primary {
  grid-column: 1 / -1;
}

.primary,
.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--purple);
  color: white;
  font-weight: 800;
  text-decoration: none;
}

.request-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-message {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.6;
}

.status-message.success {
  border-color: rgba(140, 89, 189, 0.35);
  color: var(--purple-dark);
}

.status-message.error {
  border-color: rgba(210, 17, 34, 0.32);
  color: var(--red);
}

.action-link {
  min-width: 132px;
  padding: 0 14px;
  background: var(--purple-dark);
}

@media (max-width: 720px) {
  .app {
    width: 100%;
  }

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

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

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

  .request-actions {
    grid-column: 1;
  }
}

body.input-view .filters,
body.input-view .week-nav,
body.input-view .schedule-wrap {
  display: none;
}

body:not(.input-view) .selection-panel {
  display: none;
}

body.input-view .app-header h1 {
  font-size: 24px;
}

body.input-view .selection-panel {
  min-height: calc(100vh - 74px);
  align-content: start;
}

body.input-view .selection-panel form {
  align-self: start;
}
