* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --pink: #FCDEDA;
  --pink-dark: #E89AA0;
  --mint: #C8E6D5;
  --cream: #FDF6F3;
  --text: #4A3F3A;
  --gray: #888;
  --red: #d23838;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--cream);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior: none;
}

header {
  background: var(--pink);
  padding: 14px 16px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #f0c4be;
}

header h1 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 700;
}

nav.tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 50px;
  z-index: 9;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 14px 8px;
  font-size: 0.95em;
  color: var(--gray);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 600;
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--pink-dark);
}

main {
  padding: 12px;
  padding-bottom: 80px;
  max-width: 600px;
  margin: 0 auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.05em;
  font-weight: 700;
}

.radio-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  font-size: 1em;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
}

.radio-row:last-child { border-bottom: none; }

.radio-row input[type="radio"] {
  margin-right: 10px;
  transform: scale(1.3);
}

.checkbox-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
}

.checkbox-row:last-child { border-bottom: none; }

.checkbox-row input[type="checkbox"] {
  margin-right: 12px;
  transform: scale(1.4);
}

.checkbox-row .meta {
  flex: 1;
}

.checkbox-row .meta .name {
  font-weight: 600;
  font-size: 1em;
}

.checkbox-row .meta .address {
  font-size: 0.85em;
  color: var(--gray);
}

.checkbox-row .meta .memo {
  font-size: 0.8em;
  color: var(--pink-dark);
  margin-top: 2px;
}

.full-input {
  width: 100%;
  padding: 12px;
  font-size: 1em;
  border: 1px solid #ddd;
  border-radius: 10px;
  margin-bottom: 12px;
  font-family: inherit;
  color: var(--text);
  background: #fafafa;
}

.full-input:focus {
  outline: none;
  border-color: var(--pink-dark);
  background: #fff;
}

textarea.full-input {
  resize: vertical;
  min-height: 60px;
}

.form-label {
  display: block;
  font-size: 0.9em;
  font-weight: 600;
  margin-top: 8px;
  margin-bottom: 4px;
}

.req {
  background: var(--pink-dark);
  color: white;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7em;
  margin-left: 4px;
}

.primary-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--pink-dark);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.05em;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 2px 6px rgba(232, 154, 160, 0.3);
}

.primary-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(232, 154, 160, 0.3);
}

.primary-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-btn {
  flex: 1;
  padding: 12px;
  background: #fff;
  color: var(--text);
  border: 1px solid #ddd;
  border-radius: 12px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
}

.secondary-btn:active {
  background: #f5f5f5;
}

.danger-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: #fff;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 12px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
}

.form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.member-item {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.member-item .name {
  font-weight: 700;
  font-size: 1.05em;
}

.member-item .address,
.member-item .phone,
.member-item .memo {
  font-size: 0.9em;
  color: var(--gray);
  margin-top: 4px;
}

.member-item .memo {
  color: var(--pink-dark);
  font-weight: 600;
}

.member-item .actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.member-item .actions button {
  flex: 1;
  padding: 8px;
  font-size: 0.9em;
  background: #f5f5f5;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.member-item .actions .del {
  color: var(--red);
}

#route-list {
  padding-left: 20px;
  margin: 0;
}

#route-list li {
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 1em;
}

#route-list li.start,
#route-list li.end {
  font-weight: 700;
  color: var(--pink-dark);
}

#route-list li .name {
  font-weight: 600;
}

#route-list li .address {
  font-size: 0.85em;
  color: var(--gray);
  margin-top: 2px;
}

.muted {
  color: var(--gray);
}

.muted.small {
  font-size: 0.85em;
}

.hidden {
  display: none !important;
}

.select-count {
  text-align: right;
  font-size: 0.9em;
  color: var(--gray);
  margin-top: 8px;
}

#selected-count {
  font-weight: 700;
  color: var(--pink-dark);
  font-size: 1.2em;
}

#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  z-index: 100;
  font-size: 0.95em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#loading {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--pink);
  border-top-color: var(--pink-dark);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
