* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 12px;
}

.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 640px;
  overflow: hidden;
}

.card-header {
  background: #4a86e8;
  padding: 24px;
}

.card-header h1 {
  color: white;
  font-size: 22px;
  margin: 0;
}

.card-header p {
  color: rgba(255,255,255,0.85);
  margin-top: 4px;
  font-size: 14px;
}

.card-body {
  padding: 20px;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 6px;
  color: #333;
}

input[type="text"],
input[type="date"],
input[type="time"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  color: #333;
  transition: border-color 0.2s;
  background: white;
}

input:focus, select:focus {
  outline: none;
  border-color: #4a86e8;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  cursor: pointer;
  transition: 0.3s;
}

.slider:before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .slider {
  background: #4a86e8;
}

.toggle input:checked + .slider:before {
  transform: translateX(22px);
}

.toggle-label {
  font-size: 14px;
  color: #333;
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.time-row.hidden { display: none; }

.half-day-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.half-day-row.hidden { display: none; }

.half-day-btn {
  flex: 1;
  min-width: 130px;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #4a86e8;
  background: white;
  color: #4a86e8;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.half-day-btn:hover { background: #f0f4ff; }

.user-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px 4px 0 0;
  font-size: 14px;
  border-bottom: none;
  background: white;
}

.user-search:focus {
  outline: none;
  border-color: #4a86e8;
}

.user-list {
  border: 1px solid #ddd;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  background: white;
}

.user-option {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.user-option:hover { background: #f0f4ff; }

.user-option.selected {
  background: #e8f0fe;
  font-weight: bold;
}

.user-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}

.selected-users {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-chip {
  background: #e8f0fe;
  color: #1a56db;
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-chip button {
  background: none;
  border: none;
  color: #1a56db;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.card-footer {
  padding: 16px 20px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 24px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: #4a86e8; color: white; }

.btn-secondary {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
}

.status {
  display: none;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 16px;
}

.status.success { background: #d9ead3; color: #2d6a2d; display: block; }
.status.error { background: #fce5cd; color: #7a3000; display: block; }
.status.info { background: #e8f0fe; color: #1a56db; display: block; }

.loading {
  text-align: center;
  padding: 12px;
  color: #757575;
  font-size: 14px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
  flex: 1;
  padding: 14px 8px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: bold;
  color: #757575;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn.active {
  color: #4a86e8;
  border-bottom-color: #4a86e8;
}

.tab-btn:hover:not(.active) { color: #333; }

.hidden { display: none; }

.weekday-pill {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: white;
  color: #333;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.weekday-pill.active {
  background: #4a86e8;
  color: white;
  border-color: #4a86e8;
}

#previewBanner {
  display: none;
  background: #fef3c7;
  color: #78350f;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid #f59e0b;
  width: 100%;
  max-width: 640px;
}

/* Sign-in gate */
#signinGate {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
  padding: 32px 24px;
  text-align: center;
}

#signinGate h1 { font-size: 20px; margin-bottom: 8px; color: #333; }
#signinGate p { font-size: 14px; color: #757575; margin-bottom: 20px; }
#signinGate .g_id_signin_wrap { display: flex; justify-content: center; }

@media (max-width: 480px) {
  .card-footer { justify-content: stretch; }
  .card-footer .btn { flex: 1; }
}
