/* Mobile-first, neutral palette. The web app's audience is a guest the
   family invited for a short window — soft and friendly, not enterprise. */

:root {
  color-scheme: light;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #1f2937;
  --primary-text: #ffffff;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 88px);
}

.loading, .empty, .error {
  text-align: center;
  color: var(--muted);
  margin: 48px 0;
}

.error { color: var(--danger); }

header.guest-header {
  margin: 8px 0 16px;
}
header.guest-header h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
}
header.guest-header .window {
  color: var(--muted);
  font-size: 14px;
}

.day-group { margin: 24px 0 0; }
.day-group h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 4px 8px;
}

.event {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.event:active { background: #f1f5f9; }
.event .title { font-weight: 600; }
.event .time { color: var(--muted); font-size: 14px; margin-top: 2px; }
.event .where { color: var(--muted); font-size: 14px; }

.fab {
  position: fixed;
  right: calc(env(safe-area-inset-right) + 16px);
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  background: var(--primary);
  color: var(--primary-text);
  width: 56px; height: 56px;
  border: none;
  border-radius: 28px;
  font-size: 28px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  cursor: pointer;
}
.fab:active { transform: scale(0.96); }

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10;
}

.sheet {
  background: var(--card);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 640px;
  padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px);
  max-height: 90vh;
  overflow-y: auto;
}
.sheet h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input[type="text"],
.field input[type="date"],
.field input[type="time"],
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: white;
  color: var(--text);
}
.field textarea { resize: vertical; min-height: 64px; }

.row {
  display: flex;
  gap: 8px;
}
.row > .field { flex: 1; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.btn {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.btn.primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}
.btn.danger {
  background: white;
  color: var(--danger);
  border-color: var(--danger);
}

.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 88px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 0.95; }
