:root {
  color-scheme: light;
  --leaf: #2f9c67;
  --leaf-dark: #17624b;
  --sprout: #74d2a1;
  --moss: #bfe35b;
  --sky: #74d2e7;
  --berry: #ef5f7a;
  --sun: #ffe066;
  --peach: #ffb067;
  --violet: #6d72d9;
  --ink: #19352f;
  --muted: #60746d;
  --line: #cfe8d4;
  --paper: #fff7d7;
  --surface: #ffffff;
  --shadow: 0 18px 42px rgba(25, 53, 47, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body,
.app-shell {
  height: 100%;
  margin: 0;
}

body {
  background:
    linear-gradient(135deg, rgba(255, 224, 102, 0.35), transparent 32%),
    linear-gradient(315deg, rgba(116, 210, 231, 0.32), transparent 34%),
    var(--paper);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(330px, 410px) 1fr;
  min-height: 100vh;
}

.journal-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 224, 102, 0.45) 0 16%, transparent 16% 100%),
    linear-gradient(225deg, rgba(116, 210, 231, 0.36) 0 18%, transparent 18% 100%),
    linear-gradient(180deg, #fffdf1 0%, #ecfbef 100%);
  overflow: auto;
  padding: 22px;
  position: relative;
  z-index: 2;
}

.brand,
.brand-lockup,
.section-heading,
.dialog-header,
.dialog-actions,
.action-row,
.dialog-action-group {
  display: flex;
  align-items: center;
}

.brand,
.section-heading,
.dialog-header,
.dialog-actions {
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  flex: 0 0 auto;
  height: 64px;
  width: 64px;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  color: var(--berry);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  line-height: 1;
}

h2 {
  font-size: 1rem;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #fff1a8;
  color: var(--leaf-dark);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 8px 10px;
}

.helper {
  border-left: 6px solid var(--sky);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  padding: 10px 12px;
}

.action-row {
  gap: 10px;
}

.primary-action,
.secondary-action,
.tool-button,
.text-action,
.danger-action,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
}

.primary-action {
  align-items: center;
  background: linear-gradient(135deg, var(--leaf), #21a7a1);
  color: #fff;
  display: inline-flex;
  flex: 1;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  padding: 0 16px;
}

.button-icon {
  border: 2px solid currentColor;
  border-radius: 50%;
  display: inline-grid;
  height: 22px;
  line-height: 1;
  place-items: center;
  width: 22px;
}

.secondary-action,
.tool-button {
  background: #fff7d7;
  color: var(--leaf-dark);
  font-weight: 800;
  padding: 0 14px;
}

.text-action {
  background: transparent;
  color: var(--leaf);
  font-size: 0.84rem;
  font-weight: 800;
  min-height: 32px;
}

.danger-action {
  background: #fde7e7;
  color: #9e2631;
  font-weight: 800;
  padding: 0 14px;
}

.icon-button {
  background: #fff7d7;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  height: 38px;
  width: 38px;
}

.filters {
  display: grid;
  gap: 10px;
}

.search-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  outline: 0;
  padding: 11px 12px;
  width: 100%;
}

input:focus,
textarea:focus {
  border-color: var(--peach);
  box-shadow: 0 0 0 3px rgba(47, 111, 78, 0.16);
}

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

.chip-row,
.category-grid,
.category-maker {
  display: grid;
  gap: 8px;
}

.chip-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-maker {
  margin-top: 2px;
}

.category-maker-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.chip,
.category-option {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  font-weight: 800;
  gap: 8px;
  justify-content: flex-start;
  min-height: 42px;
  padding: 0 10px;
}

.chip.active,
.category-option.active,
.tool-button.active {
  background: #fff1a8;
  border-color: var(--leaf);
  color: var(--leaf-dark);
}

.category-dot,
.marker-pin {
  border-radius: 50%;
  display: inline-grid;
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 900;
  height: 24px;
  place-items: center;
  width: 24px;
}

.discoveries {
  display: grid;
  gap: 10px;
}

.discovery-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.discovery-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(25, 53, 47, 0.09);
  display: grid;
  gap: 8px;
  padding: 12px;
}

.discovery-card.active {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(47, 111, 78, 0.14);
}

.card-top {
  align-items: center;
  display: flex;
  gap: 10px;
}

.card-title {
  flex: 1;
  min-width: 0;
}

.card-title strong,
.card-title span,
.card-note {
  overflow-wrap: anywhere;
}

.card-title strong {
  display: block;
}

.card-title span,
.card-note,
.meta-line,
.empty-state {
  color: var(--muted);
  font-size: 0.84rem;
}

.card-note {
  line-height: 1.35;
}

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

.card-actions button {
  background: #eef6eb;
  border: 0;
  border-radius: 8px;
  color: var(--leaf-dark);
  font-size: 0.82rem;
  font-weight: 800;
  min-height: 34px;
  padding: 0 10px;
}

.empty-state {
  background: rgba(255, 255, 255, 0.55);
  border: 2px dashed #a7dcae;
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 18px;
}

.empty-state.is-hidden {
  display: none;
}

.map-stage {
  min-height: 100vh;
  position: relative;
}

#map {
  height: 100%;
  min-height: 100vh;
  width: 100%;
}

.map-toolbar {
  display: flex;
  gap: 8px;
  left: 18px;
  position: absolute;
  top: 18px;
  z-index: 500;
}

.tool-button {
  border: 1px solid rgba(25, 53, 47, 0.14);
  box-shadow: 0 8px 24px rgba(25, 53, 47, 0.14);
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.popup-card {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.popup-card strong {
  font-size: 1rem;
}

.marker-pin {
  border: 2px solid #fff;
  box-shadow: 0 6px 14px rgba(29, 42, 36, 0.3);
  color: #fff;
  height: 32px;
  width: 32px;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 540px;
  padding: 0;
  width: min(calc(100vw - 28px), 540px);
}

dialog::backdrop {
  background: rgba(29, 42, 36, 0.42);
}

.entry-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.entry-form label {
  color: var(--ink);
  display: grid;
  font-size: 0.88rem;
  font-weight: 800;
  gap: 7px;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

legend {
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.category-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkbox-row {
  align-items: center;
  display: flex !important;
  gap: 9px;
}

.checkbox-row input {
  flex: 0 0 auto;
  width: auto;
}

.location-readout {
  background: #fff7d7;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 10px;
}

.dialog-action-group {
  gap: 10px;
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 52vh auto;
  }

  .journal-panel {
    border-right: 0;
    order: 2;
  }

  .map-stage {
    min-height: 52vh;
    order: 1;
  }

  #map {
    min-height: 52vh;
  }

  .map-toolbar {
    left: 10px;
    right: 10px;
    top: 10px;
  }

  .tool-button {
    flex: 1;
  }
}

@media (max-width: 460px) {
  .journal-panel {
    padding: 16px;
  }

  .brand,
  .action-row,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .chip-row,
  .category-grid,
  .category-maker-row {
    grid-template-columns: 1fr;
  }

  .dialog-action-group {
    display: grid;
    width: 100%;
  }
}


.journal-panel::after {
  background:
    linear-gradient(45deg, transparent 0 42%, rgba(255, 176, 103, 0.42) 42% 58%, transparent 58% 100%),
    linear-gradient(-45deg, transparent 0 42%, rgba(116, 210, 231, 0.42) 42% 58%, transparent 58% 100%);
  bottom: 18px;
  content: "";
  height: 46px;
  opacity: 0.7;
  pointer-events: none;
  position: absolute;
  right: 18px;
  width: 46px;
}

.chip:hover,
.category-option:hover,
.tool-button:hover,
.secondary-action:hover {
  transform: translateY(-1px);
}

.chip,
.category-option,
.tool-button,
.secondary-action,
.primary-action {
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}


.badge-stack {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  justify-items: end;
}

.sync-badge {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 5px 8px;
}

.login-form {
  max-width: 420px;
}

.login-error {
  color: #b8263d;
  font-size: 0.86rem;
  font-weight: 800;
  min-height: 1.2em;
}


.chip-label {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}




.manage-action {
  width: 100%;
}

.category-manager-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.category-manager-item {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 48px;
  padding: 8px 10px;
}

.category-manager-note {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.location-permission-card {
  max-width: 430px;
}

.location-choice-grid {
  display: grid;
  gap: 10px;
}

.location-choice-grid .primary-action,
.location-choice-grid .secondary-action,
.location-choice-grid .text-action {
  width: 100%;
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}
