:root {
  --bg: #f6f3ef;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #e86b4a;
  --primary-dark: #cf5638;
  --accent: #2f9e7a;
  --border: #e8e2da;
  --shadow: 0 8px 24px rgba(31, 41, 55, 0.08);
  --radius: 16px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, #fff7f2 0%, var(--bg) 40%);
  min-height: 100vh;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.brand-text { font-size: 18px; }

.app-main {
  flex: 1;
  padding: 8px 16px 32px;
}

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero h1 {
  font-size: 28px;
  line-height: 1.25;
  margin: 8px 0 12px;
}

.hero p, .hint {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 16px;
}

.view-head { margin-bottom: 12px; }
.view-head h2 { margin: 8px 0 4px; font-size: 24px; }

.back-btn {
  border: none;
  background: none;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  font-size: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.card.center { text-align: center; padding: 32px 20px; }

.stack { display: flex; flex-direction: column; gap: 12px; }

.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
  transition: 0.15s ease;
}

.btn:hover { border-color: #d5cdc3; }
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #faf7f4; }
.btn.block { width: 100%; }

.link-btn {
  border: none;
  background: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.field-label { font-size: 14px; color: var(--muted); margin-bottom: 6px; display: block; }

.field input,
.field select,
.field textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
}

.field textarea { resize: vertical; min-height: 100px; }

.row { display: flex; gap: 10px; align-items: end; }
.row .grow { flex: 1; }

.divider {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0;
}

.demo-account-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-account-btn {
  text-align: left;
}

.demo-hint {
  margin: 0;
  font-size: 12px;
}

.steps {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.step {
  flex: 1;
  min-width: 90px;
  text-align: center;
  font-size: 12px;
  padding: 8px 6px;
  border-radius: 999px;
  background: #efe9e2;
  color: var(--muted);
}

.step.active {
  background: #ffe8df;
  color: var(--primary-dark);
  font-weight: 600;
}

.step-panel { display: none; }
.step-panel.active { display: block; }

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  flex: 1;
  border: none;
  background: #efe9e2;
  border-radius: 999px;
  padding: 10px;
  cursor: pointer;
  color: var(--muted);
}

.tab.active {
  background: #ffe8df;
  color: var(--primary-dark);
  font-weight: 600;
}

.login-panel { display: none; }
.login-panel.active { display: block; }

.checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.checklist li::before { content: "○ "; }
.checklist li.ok { color: var(--accent); }
.checklist li.ok::before { content: "✓ "; }

.info-box {
  background: #f0faf6;
  border: 1px solid #cce9de;
  color: #1f6b52;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border);
  background: #faf7f4;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}

.chip.selected {
  background: #ffe8df;
  border-color: #f3b09d;
  color: var(--primary-dark);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}

.progress-wrap { margin-bottom: 12px; }
.progress-label { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.progress-bar {
  height: 8px;
  background: #ece5dd;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #5bc49f);
  transition: width 0.2s ease;
}

.home-hero {
  margin-bottom: 14px;
}

.home-hero h2 { margin: 0 0 6px; }
.home-hero p { margin: 0; color: var(--muted); }

.section-title {
  font-weight: 700;
  margin-bottom: 12px;
}

.child-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.child-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #faf7f4;
}

.child-card strong { display: block; margin-bottom: 4px; }
.child-card span { font-size: 13px; color: var(--muted); }

.candidate-list { display: flex; flex-direction: column; gap: 10px; }

.candidate {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #faf7f4;
}

.candidate.unread {
  border-color: #f3b09d;
  background: #fff9f6;
}
.candidate p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }

.status-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
  margin: 0 auto 12px;
}

.status-icon.warn {
  background: #fff4df;
  color: #b7791f;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(31, 41, 55, 0.92);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  max-width: calc(100% - 32px);
  z-index: 100;
}

.hidden { display: none !important; }

code {
  background: #f3ede6;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13px;
}

.filter-row {
  display: flex;
  gap: 10px;
  align-items: end;
}

.playdate-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.playdate-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #faf7f4;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
  width: 100%;
}

.playdate-row:hover {
  border-color: #f3b09d;
  box-shadow: 0 4px 12px rgba(232, 107, 74, 0.12);
}

.playdate-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.playdate-row-top h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.playdate-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13px;
  color: var(--muted);
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge.draft { background: #ece5dd; color: #6b7280; }
.status-badge.published { background: #e8f4ff; color: #2563eb; }
.status-badge.partially_confirmed { background: #fff4df; color: #b7791f; }
.status-badge.confirmed { background: #e8f8f1; color: #1f6b52; }
.status-badge.cancelled { background: #fde8e8; color: #b91c1c; }
.status-badge.completed { background: #eef2ff; color: #4338ca; }
.status-badge.preview { background: #f3ede6; color: #6b7280; }

.count-badge {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.page-info {
  font-size: 13px;
  color: var(--muted);
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-header h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
}

.detail-grid dt {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}

.detail-grid dd {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--text);
}

.detail-notes p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.alert-box {
  background: #fff4df;
  border: 1px solid #f0d59a;
  color: #92400e;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  margin-top: 12px;
}

.success-banner {
  background: #ecfdf5;
  border: 1px solid #86efac;
  color: #166534;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
}

.success-banner p {
  margin: 8px 0 0;
  color: #15803d;
}

.playdate-row-badges {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.status-badge.joined {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #86efac;
}

.detail-actions .btn.block {
  margin-top: 12px;
}

@media (min-width: 520px) {
  .app-main { padding-left: 20px; padding-right: 20px; }
}
