:root {
  --bg: #f7f8f4;
  --ink: #18211f;
  --muted: #66716e;
  --line: #dfe4dd;
  --surface: #ffffff;
  --surface-strong: #eef3ec;
  --accent: #1f7a66;
  --accent-strong: #0f5d4e;
  --amber: #c98323;
  --blue: #356d91;
  --danger: #b94735;
  --shadow: 0 18px 48px rgba(23, 32, 28, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 122, 102, 0.10), transparent 42%),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(31, 122, 102, 0.16), transparent 44%),
    var(--bg);
}

.login-screen.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 22px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 2.4rem;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  color: var(--ink);
}

.form-error {
  min-height: 1.35em;
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 800;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 18px;
}

.overline {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  max-width: 760px;
  font-size: clamp(1.75rem, 7vw, 3.6rem);
  line-height: 0.98;
}

.icon-button {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 2rem;
  line-height: 1;
  box-shadow: var(--shadow);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-pill {
  max-width: 150px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.search-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.search-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 15px 16px;
  outline: none;
  box-shadow: 0 8px 20px rgba(23, 32, 28, 0.06);
}

.search-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 122, 102, 0.14);
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 800;
}

.filter.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 20px;
}

.summary-strip div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px 10px;
}

.summary-strip strong {
  display: block;
  font-size: 1.25rem;
}

.summary-strip span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.content-grid {
  display: grid;
  gap: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.section-heading select {
  max-width: 170px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 9px 10px;
  color: var(--ink);
  font-size: 0.86rem;
}

.cards {
  display: grid;
  gap: 12px;
}

.place-card {
  display: grid;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  text-align: left;
  box-shadow: 0 10px 28px rgba(23, 32, 28, 0.08);
}

.place-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 102, 0.12), var(--shadow);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.type-chip {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-strong);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.rating {
  color: var(--amber);
  font-weight: 900;
  white-space: nowrap;
}

.place-card h3 {
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.location {
  color: var(--muted);
  font-size: 0.92rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.meta-pill {
  border-radius: 999px;
  background: #f0f3f5;
  color: #455250;
  padding: 6px 9px;
  font-size: 0.78rem;
  font-weight: 800;
}

.meta-pill.green {
  background: #e1f1eb;
  color: var(--accent-strong);
}

.meta-pill.blue {
  background: #e3edf3;
  color: var(--blue);
}

.note {
  margin-bottom: 0;
  color: #3d4845;
  line-height: 1.45;
}

.detail-panel {
  position: fixed;
  inset: auto 0 0;
  z-index: 10;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(110%);
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  box-shadow: 0 -18px 60px rgba(23, 32, 28, 0.28);
  padding: 18px;
  transition: transform 180ms ease;
}

.detail-panel.open {
  transform: translateY(0);
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.detail-panel h2 {
  max-width: calc(100% - 46px);
  margin-bottom: 6px;
  font-size: 1.45rem;
}

.detail-subtitle {
  color: var(--muted);
  margin-bottom: 16px;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.action {
  display: grid;
  place-items: center;
  min-height: 54px;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  text-decoration: none;
  font-weight: 900;
}

.action.disabled {
  pointer-events: none;
  background: #c8d0cc;
  color: #eef3ec;
}

.secondary-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--accent-strong);
  padding: 12px 14px;
  font-weight: 900;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.detail-item span {
  color: var(--muted);
}

.detail-item strong {
  text-align: right;
}

.audit-box {
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 14px;
}

.audit-box p {
  margin-bottom: 8px;
  color: #34413e;
  line-height: 1.45;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
}

dialog {
  width: min(620px, calc(100% - 28px));
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: var(--shadow);
}

#adminDialog {
  width: min(760px, calc(100% - 28px));
}

dialog::backdrop {
  background: rgba(13, 18, 17, 0.46);
}

.entry-form {
  display: grid;
  gap: 14px;
  max-height: min(82vh, 760px);
  overflow-y: auto;
  padding: 18px;
}

.compact-form {
  border-bottom: 1px solid var(--line);
  padding: 0 0 16px;
}

.admin-panel {
  display: grid;
  gap: 16px;
  max-height: min(84vh, 780px);
  overflow-y: auto;
  padding: 18px;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.user-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-row strong {
  display: block;
}

.user-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.mini-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 900;
}

.audit-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.audit-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  color: #34413e;
  font-size: 0.86rem;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-header h2 {
  margin: 0;
}

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

.entry-form input,
.entry-form select,
.entry-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--ink);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 10px 12px;
  color: var(--ink);
}

.checkbox-row input {
  width: auto;
}

.primary-button,
.text-button {
  border: 0;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-weight: 900;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.text-button {
  background: transparent;
  color: var(--muted);
}

@media (min-width: 820px) {
  .app-shell {
    padding: 32px;
  }

  .search-panel {
    grid-template-columns: minmax(320px, 1fr) auto;
    align-items: end;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr) 390px;
    align-items: start;
  }

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

  .detail-panel {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    transform: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .detail-panel:not(.open) {
    display: block;
  }

  .detail-close {
    display: none;
  }

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