:root {
  --ink: #19352d;
  --muted: #66746e;
  --cream: #f8f5ee;
  --paper: #fffdf8;
  --line: #e8e2d7;
  --sage: #446f5f;
  --sage-dark: #2e5648;
  --terracotta: #c96b4c;
  --danger: #a43f35;
  --shadow: 0 18px 50px rgba(24, 52, 44, .16);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: Arial, Helvetica, sans-serif; }
button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { display: flex; height: 100dvh; overflow: hidden; }
.sidebar { position: relative; z-index: 500; display: flex; width: 370px; min-width: 370px; flex-direction: column; gap: 17px; padding: 27px 25px 19px; background: var(--paper); box-shadow: 7px 0 30px rgba(27, 54, 46, .11); }
.brand-row, .login-brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { display: grid; width: 43px; height: 43px; flex: 0 0 43px; place-items: center; border-radius: 14px 14px 14px 5px; color: #fffaf0; background: var(--sage-dark); box-shadow: 0 6px 16px rgba(46,86,72,.25); font-family: Georgia, serif; font-size: 25px; font-weight: 700; }
.eyebrow, .login-brand small { margin: 0 0 2px; color: #8c7664; font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.brand-row h1, .login-brand h1 { margin: 0; font-family: Georgia, serif; font-size: 27px; letter-spacing: -.02em; }
.privacy-pill { display: inline-flex; width: fit-content; align-items: center; gap: 7px; margin-top: -5px; padding: 6px 10px; border-radius: 999px; color: var(--sage-dark); background: #eaf2ed; font-size: 11px; font-weight: 700; }
.privacy-pill span, .private-note { color: #69a37f; }
.search-box { display: flex; align-items: center; gap: 9px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.search-box:focus-within { border-color: #9eb8ad; box-shadow: 0 0 0 3px #dce9e3; }
.search-box > span:first-child { color: #7d8a85; font-size: 20px; line-height: 1; transform: rotate(-20deg); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search-box input::placeholder { color: #9aa39f; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; margin-top: 3px; }
.sidebar-heading h2 { margin: 0; font-size: 13px; letter-spacing: .03em; }
.sidebar-heading span { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; color: var(--muted); background: #eeeae2; font-size: 11px; }
.place-list { display: flex; max-height: calc(100dvh - 370px); flex-direction: column; gap: 10px; overflow-y: auto; padding: 1px 3px 8px 0; }
.loading-card, .empty-card { padding: 22px; border: 1px dashed #d6cec1; border-radius: 14px; color: var(--muted); text-align: center; font-size: 11px; line-height: 1.5; }
.place-card { display: grid; grid-template-columns: 88px 1fr; gap: 12px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 16px; text-align: left; background: #fff; cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s; }
.place-card:hover, .place-card.active { transform: translateY(-1px); border-color: #afc3b9; box-shadow: 0 9px 23px rgba(34,60,52,.09); }
.place-card-photo { position: relative; min-height: 90px; overflow: hidden; border-radius: 11px; background: linear-gradient(160deg,#c6c6a9 0 35%,#9baa8b 35% 56%,#766f60 56% 77%,#b9a27e 77%); }
.place-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.place-card-photo span { position: absolute; right: 6px; bottom: 6px; padding: 4px 6px; border-radius: 7px; color: #fff; background: rgba(18,39,32,.72); font-size: 9px; }
.place-card-copy { min-width: 0; padding: 2px 2px 0 0; }
.place-card-copy strong { display: block; overflow: hidden; font-family: Georgia, serif; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.place-card-copy p { display: -webkit-box; margin: 7px 0; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.place-card-copy small { color: #9a8c80; font-size: 9px; }
.sidebar-spacer { flex: 1; }
.primary-button { display: flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 0; border-radius: 12px; color: #fff; background: var(--sage-dark); box-shadow: 0 8px 18px rgba(46,86,72,.2); font-size: 12px; font-weight: 700; cursor: pointer; }
.primary-button:hover { background: #24483c; }
.primary-button:disabled { cursor: wait; opacity: .65; }
.add-place-button span { font-size: 20px; font-weight: 400; }
.secondary-button { min-height: 37px; margin-top: -8px; border: 1px solid #cbd8d2; border-radius: 11px; color: var(--sage-dark); background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.user-row { display: flex; align-items: center; gap: 10px; padding-top: 13px; border-top: 1px solid var(--line); }
.avatar { display: grid; width: 35px; height: 35px; flex: 0 0 35px; place-items: center; border-radius: 50%; color: #fff; background: var(--terracotta); font-size: 10px; font-weight: 700; }
.avatar.small { width: 30px; height: 30px; flex-basis: 30px; }
.avatar.tiny { width: 25px; height: 25px; flex-basis: 25px; background: #819d8e; font-size: 8px; }
.user-row > span:nth-child(2), .detail-meta > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.user-row strong, .detail-meta strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-row small, .detail-meta small { color: var(--muted); font-size: 9px; }
.user-row form { margin-left: auto; }
.text-button { border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; }
.icon-button { border: 0; background: transparent; cursor: pointer; font-size: 23px; }
.mobile-only { display: none; }

.map-area { position: relative; min-width: 0; flex: 1; overflow: hidden; background: #8c947e; }
.map-canvas { position: absolute; z-index: 1; inset: 0; }
.map-topbar { position: absolute; z-index: 450; top: 21px; right: 21px; left: 21px; display: flex; justify-content: flex-end; pointer-events: none; }
.map-location-chip { display: flex; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid rgba(255,255,255,.58); border-radius: 12px; background: rgba(255,253,248,.92); box-shadow: 0 8px 24px rgba(24,42,36,.14); backdrop-filter: blur(12px); font-size: 11px; }
.map-location-chip > span { color: var(--terracotta); font-size: 18px; }
.mobile-brand, .mobile-add { display: none; }
.benitos-pin-wrap, .draft-pin-wrap { background: transparent; border: 0; }
.benitos-pin { position: relative; display: grid; width: 42px; height: 42px; place-items: center; border: 3px solid #fffaf0; border-radius: 50% 50% 50% 12%; background: var(--terracotta); box-shadow: 0 5px 15px rgba(28,45,38,.38); transform: rotate(-45deg); }
.benitos-pin span { width: 13px; height: 13px; border: 3px solid #fff; border-radius: 50%; }
.draft-pin { display: grid; width: 46px; height: 46px; place-items: center; border: 3px solid #fff; border-radius: 50%; color: #fff; background: var(--sage-dark); box-shadow: 0 7px 18px rgba(16,38,30,.35); font-size: 24px; }
.place-tooltip { padding: 7px 10px !important; border: 0 !important; border-radius: 9px !important; color: var(--ink) !important; background: #fffdf8 !important; box-shadow: 0 6px 18px rgba(28,45,38,.18) !important; font-family: Arial,sans-serif !important; font-size: 11px !important; font-weight: 700 !important; }
.leaflet-control-zoom { overflow: hidden; border: 0 !important; border-radius: 11px !important; box-shadow: 0 7px 20px rgba(20,39,33,.18) !important; }
.leaflet-control-zoom a { color: var(--ink) !important; background: #fffdf8 !important; }
.leaflet-control-attribution { font-size: 8px !important; }
.pick-banner { position: absolute; z-index: 460; top: 20px; left: 50%; display: grid; grid-template-columns: auto auto auto; align-items: center; gap: 9px 13px; padding: 12px 14px; border-radius: 13px; background: var(--paper); box-shadow: var(--shadow); transform: translateX(-50%); font-size: 11px; }
.pick-banner span { color: var(--muted); }
.pick-banner button { grid-column: 3; grid-row: 1; border: 0; color: var(--terracotta); background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; }

.detail-card { position: absolute; z-index: 470; right: 22px; bottom: 24px; width: min(445px, calc(100% - 44px)); max-height: calc(100dvh - 90px); overflow-y: auto; border: 1px solid rgba(255,255,255,.65); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); animation: lift-in .25s ease-out; }
@keyframes lift-in { from { transform: translateY(18px); opacity: 0; } }
.detail-close, .modal-close { position: absolute; z-index: 2; top: 10px; right: 10px; display: grid; width: 31px; height: 31px; place-items: center; border: 0; border-radius: 50%; color: var(--ink); background: rgba(255,253,248,.94); box-shadow: 0 3px 10px rgba(20,40,32,.13); cursor: pointer; font-size: 21px; }
.detail-gallery { display: grid; height: 165px; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px; background: #ddd8cb; }
.detail-gallery.one { display: block; }
.detail-gallery img { width: 100%; height: 100%; object-fit: cover; }
.detail-gallery > img:first-child { grid-row: 1 / 3; }
.gallery-more { position: relative; display: grid; place-items: center; overflow: hidden; color: #fff; background: #6c786f; font-weight: 700; }
.gallery-more img { position: absolute; z-index: 0; inset: 0; filter: brightness(.55); }
.gallery-more span { position: relative; z-index: 1; }
.detail-content { padding: 18px 20px 19px; }
.detail-kicker { margin: 0 0 4px !important; color: var(--terracotta) !important; font-size: 9px !important; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.detail-content h2, .modal-card h2 { margin: 0; font-family: Georgia,serif; font-size: 24px; letter-spacing: -.02em; }
.detail-description { margin: 8px 0 13px; color: var(--muted); font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.detail-meta { display: flex; align-items: center; gap: 8px; }
.comment-count { margin-left: auto; color: var(--muted); font-size: 10px; }
.comments { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.comment { display: flex; align-items: flex-start; gap: 8px; padding: 10px; border-radius: 11px; background: #f3f0e9; }
.comment p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.comment strong { color: var(--ink); }
.comment small { display: block; margin-top: 2px; color: #938a80; font-size: 8px; }
.comment-form { display: flex; gap: 7px; margin-top: 10px; }
.comment-form input { min-width: 0; flex: 1; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; outline: 0; font-size: 10px; }
.comment-form button { border: 0; border-radius: 9px; color: #fff; background: var(--sage-dark); cursor: pointer; font-size: 10px; font-weight: 700; }

.modal-backdrop { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(16,31,26,.48); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(440px,100%); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 28px; border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.modal-card.compact { width: min(400px,100%); }
.modal-card h2 { font-size: 27px; }
.modal-help { margin: 8px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.modal-card label, .stack-form label { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; color: var(--ink); font-size: 10px; font-weight: 700; }
.modal-card input:not([type=file]), .modal-card textarea, .stack-form input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; color: var(--ink); background: #fff; font-size: 12px; font-weight: 400; }
.modal-card input:focus, .modal-card textarea:focus, .stack-form input:focus { border-color: #99b4a8; box-shadow: 0 0 0 3px #dce9e3; }
.photo-upload { align-items: center; justify-content: center; min-height: 95px; border: 1px dashed #aabdb4; border-radius: 12px; color: var(--sage-dark) !important; background: #f3f7f4; cursor: pointer; }
.photo-upload input { display: none; }
.photo-upload span { font-size: 20px; line-height: 1; }
.photo-upload small { color: var(--muted); font-size: 9px; font-weight: 400; }
.coordinates { margin: 12px 0; color: #8b928f; font-family: monospace; font-size: 9px; text-align: center; }
.modal-card > .primary-button { width: 100%; margin-top: 14px; }
.toast { position: absolute; z-index: 1200; right: 24px; bottom: 24px; max-width: 340px; padding: 12px 17px; border-radius: 11px; color: #fff; background: var(--sage-dark); box-shadow: var(--shadow); font-size: 12px; animation: lift-in .25s ease-out; }
.toast.error { background: var(--danger); }

.login-page { display: grid; min-height: 100dvh; place-items: center; padding: 22px; background: radial-gradient(circle at 20% 10%, rgba(255,255,255,.9), transparent 32%), linear-gradient(145deg,#dae4dc,#eee6d6 58%,#d6bda0); }
.login-card { width: min(430px,100%); padding: 33px; border: 1px solid rgba(255,255,255,.65); border-radius: 24px; background: rgba(255,253,248,.94); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.login-card > h2 { margin: 31px 0 8px; font-family: Georgia,serif; font-size: 27px; letter-spacing: -.02em; }
.login-card > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.stack-form { margin-top: 20px; }
.stack-form .primary-button { width: 100%; margin-top: 18px; }
.private-note { display: block; margin-top: 19px; text-align: center; font-size: 9px; font-weight: 700; }
.form-error { margin: 15px 0 0; padding: 10px 12px; border-radius: 9px; color: #812e28; background: #f8ded9; font-size: 11px; }

@media (max-width: 780px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(90vw,370px); min-width: 0; transform: translateX(-105%); transition: transform .24s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: block; margin-left: auto; }
  .map-topbar { top: 14px; right: 14px; left: 14px; justify-content: space-between; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; padding: 5px 11px 5px 5px; border: 0; border-radius: 13px; background: rgba(255,253,248,.94); box-shadow: 0 8px 22px rgba(20,39,32,.16); pointer-events: auto; font-family: Georgia,serif; }
  .mobile-brand .brand-mark { width: 33px; height: 33px; flex-basis: 33px; border-radius: 10px 10px 10px 4px; font-size: 19px; }
  .map-location-chip { padding: 10px; }
  .map-location-chip strong { display: none; }
  .mobile-add { position: absolute; z-index: 450; right: 14px; bottom: 22px; display: flex; align-items: center; gap: 6px; padding: 13px 17px; border: 0; border-radius: 14px; color: #fff; background: var(--sage-dark); box-shadow: 0 9px 24px rgba(24,45,38,.3); font-size: 12px; font-weight: 700; }
  .mobile-add span { font-size: 18px; }
  .detail-card { right: 10px; bottom: 10px; width: calc(100% - 20px); max-height: 74dvh; border-radius: 19px; }
  .detail-gallery { height: 138px; }
  .detail-content { padding: 15px 16px; }
  .pick-banner { top: 72px; width: calc(100% - 28px); grid-template-columns: 1fr auto; }
  .pick-banner span { grid-column: 1; }
  .pick-banner button { grid-column: 2; grid-row: 1 / 3; }
  .leaflet-bottom.leaflet-right { bottom: 68px; }
  .modal-backdrop { align-items: end; padding: 10px; }
  .modal-card { width: 100%; max-height: 88dvh; border-radius: 20px; }
  .place-list { max-height: calc(100dvh - 380px); }
}

@media (max-height: 680px) and (min-width: 781px) {
  .sidebar { gap: 11px; padding-top: 17px; }
  .privacy-pill { display: none; }
  .place-list { max-height: calc(100dvh - 320px); }
  .detail-card { max-height: calc(100dvh - 70px); }
}
