:root {
  --bg: #faf8f5;
  --panel-bg: #ffffff;
  --border: #e4ded4;
  --text: #2c2926;
  --text-muted: #7a746a;
  --accent: #c8574a;
  --accent-dark: #a8453a;
  --booked: #4a8c5f;
  --need-to-book: #d99a3a;
  --idea: #8a8478;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

/* Name-capture modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 26, 22, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--panel-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  max-width: 380px;
  width: 100%;
}

.modal-box h3 { margin: 0 0 8px; }

.modal-box p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.modal-box input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.site-header {
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 20px 8px;
}

.header-inner h1 {
  margin: 0;
  font-size: 1.6rem;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.tabs {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

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

.panel-intro {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 20px;
}

.panel-intro code {
  background: #f1ece4;
  padding: 1px 5px;
  border-radius: 4px;
}

/* Schedule */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.day-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.day-card-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.day-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.day-date {
  font-weight: 700;
  font-size: 1rem;
}

.day-city {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.day-overnight {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.day-overnight::before { content: "🌙 "; }

.day-overnight-link {
  display: inline-block;
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s ease;
}

.day-overnight-link:hover,
.day-overnight-link:focus {
  text-decoration-color: currentColor;
}

.day-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-item {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  background: #f8f5f0;
  border-radius: 6px;
  font-size: 0.9rem;
}

.day-item-activity {
  background: #f1ece4;
}

.day-item-extra {
  background: #f1ece4;
}

.day-item-editing {
  background: #f1ece4;
}

.time-range-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-range-row span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.time-range-row input[type="time"] {
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
}

.item-time-col {
  flex: 0 0 68px;
  font-weight: 600;
  font-size: 0.85rem;
}

.item-body {
  flex: 1;
  min-width: 0;
}

.item-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}

.item-title {
  font-weight: 500;
}

.item-detail {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

.item-activity-actions {
  display: flex;
  gap: 14px;
  margin-top: 5px;
}

.text-action-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.text-action-btn:hover { color: var(--accent-dark); }

.text-action-danger { color: #b23b3b; }
.text-action-danger:hover { color: #8f2e2e; }

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

.status-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}

.status-booked { background: #e2f1e6; color: var(--booked); }
.status-need-to-book { background: #faf0dc; color: var(--need-to-book); }
.status-idea { background: #eeece7; color: var(--idea); }

.day-empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

.chip-time-input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  width: 120px;
}

.day-notes-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.day-add-section {
  margin-top: 10px;
}

.day-add-form {
  margin-top: 8px;
  padding: 10px;
  background: #f8f5f0;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-add-form.hidden { display: none; }

.day-add-input {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  width: 100%;
}

.day-add-category-select {
  font-weight: 600;
}

textarea.day-add-input {
  min-height: 50px;
  resize: vertical;
}

.day-add-subform {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.day-add-subform.hidden { display: none; }

/* Flights */
.flights-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.flight-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.flight-route {
  font-weight: 700;
  font-size: 1.05rem;
}

.flight-meta {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.btn-primary, .btn-secondary {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: #ece7de;
  color: var(--text);
}

/* Activities */
.activities-map {
  width: 100%;
  height: 360px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Split list + map layout */
.activities-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}

.activities-list-col { min-width: 0; }

.activities-map-col {
  position: sticky;
  top: 108px; /* clears the sticky site header + tabs */
}

.activities-map-col .activities-map {
  height: 70vh;
  min-height: 420px;
  max-height: 640px;
  margin-bottom: 0;
}

.mobile-only { display: none; }

@media (max-width: 899px) {
  .activities-layout { display: block; }
  .activities-map-col {
    position: static;
    display: none;
    margin-top: 16px;
  }
  .activities-map-col .activities-map {
    height: 60vh;
  }
  .activities-layout.map-active .activities-map-col { display: block; }
  .activities-layout.map-active .activities-list-col { display: none; }
  .mobile-only { display: inline-flex; }
}

.activities-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.activities-toolbar label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.activities-toolbar input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  width: 160px;
}

.add-activity-form {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-activity-form.hidden { display: none; }

.add-activity-form h3 { margin: 0 0 4px; }

.add-activity-form input,
.add-activity-form select,
.add-activity-form textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
}

.add-activity-form textarea { min-height: 60px; resize: vertical; }

.field-hint {
  margin: -4px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.autocomplete-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 2px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
  z-index: 30;
}

.autocomplete-dropdown.hidden { display: none; }

.autocomplete-item {
  padding: 8px 10px;
  font-size: 0.86rem;
  cursor: pointer;
}

.autocomplete-item:hover {
  background: #f1ece4;
}

.form-actions { display: flex; gap: 8px; }

.city-group {
  margin-bottom: 26px;
}

.city-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.city-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.activity-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.activity-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-card h4 {
  margin: 0;
  font-size: 1rem;
}

.activity-card.category-meal {
  border-left: 4px solid #d99a3a;
  padding-left: 12px;
}

.category-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.category-badge-activity {
  background: #eef1f6;
  color: #4a6fa1;
}

.category-badge-meal {
  background: #faf0dc;
  color: var(--need-to-book);
}

.category-toggle {
  display: flex;
  gap: 6px;
}

.category-toggle-btn {
  flex: 1;
  border: 1px solid var(--border);
  background: #f8f5f0;
  color: var(--text-muted);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.category-toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.activity-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.activity-notes-text {
  font-size: 0.85rem;
  color: var(--text);
}

.activity-link {
  font-size: 0.82rem;
}

.schedule-block {
  font-size: 0.82rem;
}

.schedule-add-btn {
  background: #f1ece4;
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.schedule-add-btn:hover { background: #e6dfd3; }

.scheduled-info {
  background: #f8f5f0;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.82rem;
}

.schedule-edit-btn,
.schedule-remove-btn {
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0.7;
  margin-left: 2px;
}

.schedule-edit-btn:hover,
.schedule-remove-btn:hover {
  opacity: 1;
  background: #eee7da;
}

.schedule-edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: #f8f5f0;
  border-radius: 6px;
  padding: 8px;
  margin-top: 4px;
}

.schedule-edit-row.hidden { display: none; }

.schedule-edit-row select,
.schedule-edit-row input[type="text"] {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: inherit;
}

.schedule-edit-row .schedule-day-select { flex: 1 1 100%; }
.schedule-edit-row .schedule-time-input { flex: 1 1 200px; }

.schedule-edit-row .form-actions { flex: 1 1 100%; }

.activity-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.activity-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.thumbs-btn {
  background: #f1ece4;
  border: none;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.thumbs-btn.voted {
  background: #fde3c8;
}

.notes-toggle,
.map-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
}

/* Briefly highlights an activity card when its map pin is clicked */
.activity-card.highlighted {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(200, 87, 74, 0.15);
}

.activity-notes-thread {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
  display: none;
  flex-direction: column;
  gap: 6px;
}

.activity-notes-thread.open { display: flex; }

.note-item {
  font-size: 0.82rem;
  background: #f8f5f0;
  border-radius: 6px;
  padding: 6px 8px;
}

.note-author {
  font-weight: 700;
}

.note-edited-tag {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.78rem;
}

.note-actions {
  float: right;
  display: inline-flex;
  gap: 4px;
}

.note-edit-btn,
.note-delete-btn {
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0.7;
}

.note-edit-btn:hover,
.note-delete-btn:hover {
  opacity: 1;
  background: #eee7da;
}

.note-edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.note-edit-input {
  flex: 1 1 140px;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
}

.note-save-btn,
.note-cancel-btn {
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.note-save-btn {
  background: var(--accent);
  color: #fff;
}
.note-save-btn:hover { background: var(--accent-dark); }

.note-cancel-btn {
  background: #ece7de;
  color: var(--text);
}

.activity-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.activity-card-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.activity-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-edit-input,
.activity-edit-select,
.activity-edit-textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
  width: 100%;
}

.activity-edit-textarea {
  min-height: 56px;
  resize: vertical;
}

.note-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.note-input-row input {
  flex: 1 1 140px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
}

.note-input-row button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: pointer;
}

.site-footer {
  text-align: center;
  padding: 24px 20px 40px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.site-footer a { color: var(--accent); }

@media (max-width: 600px) {
  .flight-card { flex-direction: column; align-items: flex-start; }
}
