/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --border: #e0dbd0;
  --text: #1a1a1a;
  --text-muted: #6b6660;
  --accent: #5b8dd9;
  --accent-light: #eef3fc;
  --nl-teal:   #4FC3C8;
  --nl-blue:   #5b8dd9;
  --nl-purple: #8b6fd4;
  --nl-pink:   #c46faa;
  --nl-gradient: linear-gradient(135deg, #4FC3C8 0%, #5b8dd9 33%, #8b6fd4 66%, #c46faa 100%);
  --error: #c84b2f;
  --green: #2d7a4f;
  --green-light: #e5f2eb;
  --yellow: #d4a017;
  --yellow-light: #fdf6e3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Login page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.trip-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Form elements ── */
.field {
  margin-bottom: 16px;
}

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

input[type="password"],
input[type="text"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--nl-gradient);
  background-size: 200% 100%;
  background-position: left center;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  transition: background-position 0.3s, opacity 0.15s;
}
.btn-primary:hover { background-position: right center; opacity: 0.92; }
.btn-primary:active { opacity: 0.85; }

.btn-ghost {
  padding: 8px 14px;
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-small { font-size: 13px; padding: 6px 10px; }

.btn-secondary {
  padding: 10px 16px;
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--border); }

/* ── Error message ── */
.error-msg {
  color: var(--error);
  font-size: 14px;
  margin-top: 8px;
  padding: 10px 12px;
  background: #f5e8e5;
  border-radius: var(--radius-sm);
}

.family-link {
  text-align: center;
  margin-top: 20px;
}
.family-link a {
  color: var(--text-muted);
  font-size: 14px;
  text-decoration: none;
}
.family-link a:hover { color: var(--nl-blue); }

/* ── App header ── */
.app-header {
  background: var(--surface);
  border-bottom: none;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--nl-gradient);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title .trip-icon { font-size: 24px; }

.header-title h1 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.header-title p {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Itinerary ── */
.itinerary {
  padding: 16px;
  max-width: 680px;
  margin: 0 auto;
}

.day-section {
  margin-bottom: 24px;
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
  border-bottom: 2px solid transparent;
  border-image: var(--nl-gradient) 1;
  cursor: pointer;
  user-select: none;
}

.day-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.day-header .day-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.day-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 12px;
}

.route-btn {
  font-size: 13px;
  padding: 7px 12px;
  background: var(--nl-gradient);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 1;
  transition: opacity 0.15s;
}
.route-btn:hover { opacity: 0.88; }

/* ── Place cards ── */
.places-list { display: flex; flex-direction: column; gap: 10px; }

.place-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.15s;
}

.place-card.visited {
  border-color: var(--green);
  background: var(--green-light);
}

.place-card.lodging-card {
  border-color: #b5a77d;
  background: #faf8f2;
  border-style: dashed;
}

.place-card[draggable="true"] {
  cursor: grab;
}
.place-card[draggable="true"]:active {
  cursor: grabbing;
}
.place-card.dragging {
  opacity: 0.35;
  border-style: dashed;
}
.place-card.drag-target {
  border-top: 3px solid var(--nl-blue);
}

.place-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.check-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
  margin-top: 2px;
}
.check-btn.checked {
  background: var(--nl-gradient);
  border-color: var(--nl-teal);
  color: white;
}

.place-info { flex: 1; min-width: 0; }

.place-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.place-address {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.meta-tag {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 20px;
}

.place-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.action-btn {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
}
.action-btn:hover { background: var(--surface-2); color: var(--text); }
.action-btn.active { background: var(--accent-light); border-color: var(--nl-blue); color: var(--nl-blue); }

.maps-btn {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid #b8dfc8;
  background: var(--green-light);
  color: var(--green);
  text-decoration: none;
  font-family: inherit;
  font-weight: 500;
}

/* Stars */
.stars { display: flex; gap: 2px; }
.star {
  font-size: 18px;
  cursor: pointer;
  color: var(--border);
  line-height: 1;
  transition: color 0.1s;
}
.star.filled { color: var(--yellow); }
.star:hover, .star:hover ~ .star { color: var(--yellow); }

/* Notes */
.notes-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.note-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
}
.note-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.private-badge {
  font-size: 10px;
  background: var(--yellow-light);
  color: var(--yellow);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 500;
}

/* ── Side panel (spending) ── */
.side-panel {
  position: fixed;
  inset: 0;
  background: var(--surface);
  z-index: 200;
  overflow-y: auto;
  padding: 0 0 80px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}

.panel-header h2 { font-size: 18px; font-weight: 600; }

.close-panel {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
}

#spending-content { padding: 16px; }

.spending-summary {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.spending-total {
  font-size: 28px;
  font-weight: 600;
  background: var(--nl-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.spending-total-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.spending-day { margin-bottom: 16px; }
.spending-day h3 { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }

.spending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.spending-item:last-child { border-bottom: none; }
.spending-item-desc { flex: 1; }
.spending-category {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.spending-amount { font-weight: 600; color: var(--text); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  padding: 16px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) var(--radius-sm) var(--radius-sm);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.modal-actions .btn-primary { flex: 1; }
.modal-actions .btn-secondary { flex: 1; }

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--nl-gradient);
  color: white;
  border: none;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(91,141,217,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  transition: opacity 0.15s, transform 0.15s;
}
.fab:hover { opacity: 0.92; }
.fab:active { transform: scale(0.95); }

/* ── Checkin info ── */
.checkin-info {
  font-size: 11px;
  color: var(--green);
  margin-top: 6px;
  font-weight: 500;
}

/* ── Family view ── */
.family-content { padding: 16px; max-width: 600px; margin: 0 auto; }

.family-place {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1.5px solid var(--border);
}

.family-place.visited { border-color: var(--green); background: var(--green-light); }

.family-place-name { font-size: 15px; font-weight: 600; }
.family-place-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Utility ── */
[hidden] { display: none !important; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

.text-muted { color: var(--text-muted); font-size: 14px; }

/* ── Custom place badge ── */
.custom-badge {
  font-size: 10px;
  background: var(--accent-light);
  color: var(--nl-blue);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
  vertical-align: middle;
  margin-left: 4px;
}
