* {
  box-sizing: border-box;
}

html,
body,
button,
select,
input,
label,
p,
h1,
h2,
h3,
li,
span {
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: linear-gradient(135deg, #5b6ee1 0%, #6f49b8 100%);
  font-family: 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  color: #1f2937;
}

.container {
  width: min(960px, calc(100vw - 40px));
  max-width: 960px;
  flex: 0 1 960px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 24px;
  padding: 34px;
  box-shadow: 0 24px 64px rgba(31, 41, 55, 0.22);
}

.hero {
  text-align: center;
  margin-bottom: 24px;
}

h1 {
  margin: 0 0 10px;
  font-size: 36px;
  color: #1f2937;
}

.subtitle {
  margin: 0;
  color: #6b7280;
  line-height: 1.8;
}

.hero-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-action-btn {
  min-width: 220px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.panel {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 20px;
  background: #f8fafc;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 23px;
}

.panel-head p,
.calendar-caption {
  margin: 0;
  color: #6b7280;
  line-height: 1.7;
  font-size: 14px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.form-group label,
.form-group > span,
label > span:first-child {
  font-weight: 700;
  font-size: 14px;
}

.form-group input,
.form-group select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 13px 15px;
  border: 2px solid #d7dcef;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #ffffff;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #5b6ee1;
  box-shadow: 0 0 0 4px rgba(91, 110, 225, 0.14);
}

.required {
  color: #dc2626;
}

.calendar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.calendar-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-nav-btn,
.terms-link-btn,
.submit-btn,
.dialog-close-btn,
.remove-date-btn {
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.calendar-nav-btn,
.terms-link-btn,
.remove-date-btn {
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #dbe4ff;
  color: #374151;
  font-weight: 700;
  text-decoration: none;
}

.submit-btn {
  width: 100%;
  padding: 16px 22px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.24);
}

.submit-btn.is-submitting,
.submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.78;
  transform: none;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.18);
}

.dialog-close-btn {
  width: 42px;
  height: 42px;
  background: #ffffff;
  color: #374151;
  font-size: 24px;
  line-height: 1;
}

.calendar-nav-btn:hover,
.terms-link-btn:hover,
.submit-btn:hover,
.dialog-close-btn:hover,
.remove-date-btn:hover {
  transform: translateY(-1px);
}

.calendar-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  color: #475569;
  font-size: 13px;
}

.legend-box {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 6px;
  border-radius: 5px;
  vertical-align: text-bottom;
  border: 1px solid #cbd5e1;
}

.legend-available { background: #ffffff; }
.legend-partial { background: #fef3c7; }
.legend-booked { background: #fee2e2; }
.legend-disabled { background: #e5e7eb; }
.legend-selected { background: #dbeafe; }

.calendar-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-weekday {
  text-align: center;
  font-weight: 700;
  color: #475569;
  padding: 8px 0;
}

.calendar-day {
  min-width: 0;
  min-height: 96px;
  border: 1px solid #d9e2f5;
  background: #ffffff;
  border-radius: 16px;
  padding: 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calendar-day.is-available {
  border-color: #93c5fd;
}

.calendar-day.is-partial {
  background: #fffaf0;
  border-color: #fbbf24;
}

.calendar-day.is-booked {
  background: #fff1f2;
  border-color: #fca5a5;
}

.calendar-day.is-disabled {
  background: #e5e7eb;
  color: #6b7280;
  border-color: #d1d5db;
  cursor: not-allowed;
}

.calendar-day.is-selected {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.calendar-day.is-empty {
  visibility: hidden;
}

.calendar-day-number {
  font-size: 18px;
  font-weight: 800;
}

.calendar-day-note {
  font-size: 12px;
  color: #475569;
}

.calendar-room-state {
  margin-top: auto;
  font-size: 12px;
  color: #64748b;
}

.calendar-detail {
  margin-top: 18px;
}

.calendar-detail-placeholder,
.calendar-error {
  margin: 0;
  padding: 14px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  color: #64748b;
  background: #ffffff;
}

.calendar-detail-card,
.date-config-card {
  background: #ffffff;
  border: 1px solid #dbe4ff;
  border-radius: 18px;
  padding: 18px;
}

.calendar-detail-card h3,
.date-config-head h3 {
  margin: 0;
  font-size: 18px;
}

.selected-date-summary,
.selected-date-list {
  margin: 14px 0 0;
  padding-left: 1.2em;
  display: grid;
  gap: 10px;
  line-height: 1.8;
}

.selected-date-summary li,
.selected-date-list li,
.selected-date-summary li span,
.selected-date-list li span,
.terms-dialog-body,
.copyright,
.subtitle {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.selected-date-summary li span,
.selected-date-list li span {
  display: block;
  color: #64748b;
  font-size: 13px;
}

.detail-panel.is-hidden {
  display: none;
}

.date-config-list {
  display: grid;
  gap: 16px;
}

.date-config-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

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

.inline-warning {
  display: inline-flex;
  margin-top: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff1f2;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 700;
}

.terms-consent {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.consent-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 2px solid #dbe4ff;
  border-radius: 16px;
  background: #ffffff;
  cursor: pointer;
}

.consent-tile input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.consent-mark {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 2px solid #94a3b8;
  background: #ffffff;
  position: relative;
  flex: 0 0 auto;
}

#agreeTerms:checked + .consent-mark {
  background: #2563eb;
  border-color: #2563eb;
}

#agreeTerms:checked + .consent-mark::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 1px;
  width: 5px;
  height: 11px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.consent-text {
  font-weight: 700;
}

.terms-dialog {
  border: none;
  padding: 0;
  width: min(880px, calc(100vw - 24px));
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
}

.terms-dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
}

.terms-dialog-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 980px);
}

.terms-dialog-head,
.terms-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: #eff6ff;
}

.terms-dialog-head h2 {
  margin: 0;
  font-size: 24px;
}

.terms-dialog-actions {
  border-top: 1px solid #dbe4ff;
}

.terms-dialog-body {
  padding: 20px;
  max-height: 65vh;
  overflow: auto;
  background: #ffffff;
  line-height: 1.9;
}

.terms-dialog-body.terms-dialog-body-embed {
  padding: 0;
  overflow: hidden;
}

.terms-iframe {
  display: block;
  width: 100%;
  height: 65vh;
  border: none;
  background: #ffffff;
}

.terms-dialog-body section {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #f8fafc;
}

.terms-dialog-body h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.terms-dialog-body ul {
  margin: 0;
  padding-left: 1.2em;
}

.manual-dialog {
  width: min(960px, calc(100vw - 24px));
}

.manual-dialog-body {
  padding: 16px 20px;
  background: #f8fafc;
}

.manual-embed-wrap {
  border: 1px solid #dbe4ff;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  min-height: 68vh;
}

.manual-pdf-frame {
  display: block;
  width: 100%;
  height: 68vh;
  border: none;
}

.button-group {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.copyright {
  margin: 28px 0 0;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}
