*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f2f5;
  color: #333;
  padding: 20px;
}

.container { max-width: 600px; margin: 0 auto; }

header { text-align: center; margin-bottom: 24px; position: relative; }
header h1 { font-size: 1.8rem; color: #2c3e50; }
.subtitle { color: #888; margin-top: 6px; }

#bg-picker-btn {
  position: absolute;
  top: 0; right: 0;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  font-size: 1.2rem;
  padding: 6px 8px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}
#bg-picker-btn:hover { background: rgba(255,255,255,0.9); }

#bg-picker-panel {
  position: absolute;
  top: 44px; right: 0;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 100;
  min-width: 220px;
  text-align: left;
}

.bg-picker-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.bg-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.bg-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.bg-swatch:hover { transform: scale(1.1); }
.bg-swatch.active { border-color: #333; }

.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.card h2 {
  font-size: 0.78rem;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}

/* Person buttons */
.person-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.person-btn {
  padding: 18px 10px;
  border: 3px solid transparent;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.person-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.15); }

.person-btn.selected {
  border-color: #1a1a2e;
  transform: scale(1.04);
  box-shadow: 0 4px 18px rgba(0,0,0,0.2);
}

/* Form */
.form-group { margin-bottom: 16px; }

label { display: block; font-size: 0.875rem; font-weight: 600; color: #555; margin-bottom: 6px; }

input[type="text"],
input[type="date"],
input[type="time"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e5e5e5;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input:focus { outline: none; border-color: #4A90D9; }

.checkbox-group label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 1rem; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; }

.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 14px 24px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s, transform 0.1s;
}

.btn-submit { width: 100%; background: #2ECC71; color: white; margin-top: 6px; }
.btn-submit:hover:not(:disabled) { background: #27ae60; }
.btn-submit:disabled { background: #ccc; cursor: not-allowed; }

.btn-auth { background: #4A90D9; color: white; margin-top: 12px; }

/* Auth banner */
.auth-banner {
  background: #fff8e1;
  border: 1px solid #ffcc02;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}

/* Events list */
#events-list { display: flex; flex-direction: column; gap: 8px; }

.event-item {
  padding: 10px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #ccc;
}

.event-title { font-weight: 600; font-size: 0.9rem; }
.event-time  { font-size: 0.8rem; color: #888; margin-top: 3px; }
.muted       { color: #aaa; text-align: center; padding: 20px; }

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 28px;
  border-radius: 8px;
  color: white;
  font-weight: 700;
  z-index: 999;
  animation: slideUp 0.3s ease;
}
.toast.success { background: #2ECC71; }
.toast.error   { background: #e74c3c; }

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hidden { display: none !important; }

/* ── Edit & Delete Buttons ───────────────────────────────── */
.event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.event-info { flex: 1; min-width: 0; }

.event-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 8px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s;
  line-height: 1;
}

.btn-edit:hover   { background: #e8f0fe; }
.btn-delete:hover { background: #fce8e6; }

/* ── Cancel Button ───────────────────────────────────────── */
.btn-cancel {
  width: 100%;
  background: #f0f0f0;
  color: #555;
  margin-top: 8px;
}

.btn-cancel:hover { background: #e0e0e0; }

/* ── Edit Mode Form Highlight ────────────────────────────── */
.editing-mode {
  border: 2px solid #4A90D9 !important;
}

/* ── Section header hint ─────────────────────────────────── */
.card h2 .hint {
  font-size: 0.7rem;
  font-weight: 400;
  color: #bbb;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Tentative button (dashed, no fill) ──────────────────── */
.btn-tentative {
  background: transparent !important;
  border-style: dashed !important;
  font-weight: 700;
}

.btn-tentative.selected {
  background: #95A5A6 !important;
  color: white !important;
  border-style: solid !important;
}

/* ── Tentative events in the list (dashed left border) ───── */
.event-item.event-tentative {
  border-left-style: dashed;
  opacity: 0.82;
}

/* ── Recurring Fields ────────────────────────────────────── */
input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e5e5e5;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input[type="number"]:focus { outline: none; border-color: #4A90D9; }

.field-hint {
  font-size: 0.78rem;
  color: #aaa;
  margin-top: 5px;
}

input[type="checkbox"]:disabled + span,
input[type="checkbox"]:disabled ~ *,
input#recurring:disabled { opacity: 0.4; cursor: not-allowed; }