* { box-sizing: border-box; }

/* Must win over any element's own display rule below, so that JS setting
   .hidden = true always actually hides it (an ID selector like #auth-screen
   setting display:flex otherwise beats the browser's default [hidden] rule). */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #fdf3f9;
  color: #5b4b66;
  line-height: 1.4;
}

#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-box {
  max-width: 360px;
  width: 100%;
}

.auth-box h1 { margin-bottom: 0; color: #c76fa8; }
.subtitle { color: #b98ec9; margin-top: 0.25rem; }

input, textarea, select, button {
  font: inherit;
  width: 100%;
  padding: 0.65rem;
  margin: 0.35rem 0 0.75rem;
  border-radius: 12px;
  border: 1px solid #f0d6ea;
  background: #fffbfd;
  color: #5b4b66;
}

button {
  cursor: pointer;
  background: #f3d9ee;
  border: 1px solid #eabde0;
}

button.primary {
  background: #f6a8d0;
  border-color: #f191c3;
  color: #5b3a53;
  font-weight: 600;
  padding: 0.9rem;
}

button.link-btn {
  width: auto;
  background: none;
  border: none;
  color: #d16fa8;
  text-decoration: underline;
  padding: 0.25rem 0;
  margin: 0 0 0.5rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #f5dff0;
  position: sticky;
  top: 0;
  background: #fdf3f9;
  z-index: 5;
}

.muted { color: #b98ec9; font-size: 0.85rem; margin-left: 0.5rem; }

.sync-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #faeaf5;
  border-bottom: 1px solid #f5dff0;
  flex-wrap: wrap;
}
.sync-bar button { width: auto; margin: 0; }

.status { font-size: 0.85rem; color: #b98ec9; margin: 0.25rem 0 0; }

form, #entries-list, h2 { padding: 0 1rem; }

fieldset {
  border: 1px solid #f5dff0;
  border-radius: 14px;
  margin: 1rem 0;
  padding: 0.75rem 1rem 1rem;
  background: #fffbfd;
}

legend {
  padding: 0 0.4rem;
  color: #c76fa8;
  font-weight: 600;
  font-size: 0.9rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: #7a6485;
  margin-top: 0.5rem;
}

.inline-fields {
  border-left: 2px solid #f0d6ea;
  padding-left: 0.75rem;
  margin-bottom: 0.75rem;
}

.capture-btn {
  display: inline-block;
  width: auto;
  background: #f3d9ee;
  border: 1px solid #eabde0;
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  margin: 0.25rem 0.5rem 0.5rem 0;
  cursor: pointer;
}

#media-list { margin-top: 0.5rem; }
.media-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f5dff0;
  font-size: 0.85rem;
}
.media-item input { width: auto; flex: 1; margin: 0; }
.media-item button { width: auto; margin: 0; padding: 0.3rem 0.6rem; }

.entry {
  border: 1px solid #f5dff0;
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
  background: #fffbfd;
}
.entry.pending { border-left: 4px solid #ffc48a; }
.entry.synced { border-left: 4px solid #8fdcb8; }
.entry-title { font-weight: 600; color: #5b4b66; }
.entry-meta { font-size: 0.8rem; color: #b98ec9; }
.empty { color: #b98ec9; }

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0;
}
.tab-btn {
  width: auto;
  margin: 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.5rem 0.25rem;
  color: #b98ec9;
}
.tab-btn.active {
  color: #c76fa8;
  border-bottom-color: #f6a8d0;
  font-weight: 600;
}

/* Places tab */
#places-search {
  margin-top: 0.5rem;
}
.place-row {
  border: 1px solid #f5dff0;
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
  background: #fffbfd;
}
.place-row .place-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.place-row .place-meta {
  font-size: 0.75rem;
  color: #b98ec9;
}
.place-row input[type="text"], .place-row textarea {
  margin: 0.35rem 0;
}
.place-row button {
  width: auto;
  padding: 0.3rem 0.7rem;
  margin: 0.35rem 0.35rem 0 0;
}
.place-row.dirty { border-left: 4px solid #ffc48a; }

.place-row select {
  margin: 0.35rem 0;
}

.place-row .visit-visited { color: #4fae82; }
.place-row .visit-want_to_visit { color: #ea7f45; }
.place-row .visit-reference_only { color: #9c86b0; }

/* Map tab */
.inline-fields label {
  display: inline-block;
  width: auto;
  margin-right: 0.75rem;
}
.inline-fields select {
  width: auto;
  display: inline-block;
}
#map-container {
  height: 70vh;
  min-height: 320px;
  border-radius: 14px;
  overflow: hidden;
  margin-top: 0.5rem;
  border: 1px solid #f5dff0;
}
.leaflet-popup-content { color: #5b4b66; }
