/* PathKH (pathkh.com) - shared styles for the public map and the admin panel.
   One stylesheet, no build step, no framework.
   Look: deep navy surfaces, royal-blue structure, gold for anything you act on. */

:root {
  --bg:        #060f24;
  --surface:   #0c1a38;
  --surface-2: #122447;
  --surface-3: #1a3060;
  --line:      rgba(125, 165, 255, 0.16);
  --line-2:    rgba(125, 165, 255, 0.28);
  --text:      #eaf0ff;
  --muted:     #93a3c7;

  --gold:      #f2c14e;
  --gold-2:    #dca629;
  --gold-ink:  #241a03;
  --gold-soft: rgba(242, 193, 78, 0.14);
  --blue:      #3b82f6;
  --blue-2:    #2563eb;
  --blue-soft: rgba(59, 130, 246, 0.16);

  --ok:        #34d399;
  --danger:    #f87171;

  --r-xl: 24px;
  --r-lg: 18px;
  --r:    14px;
  --r-sm: 10px;
  --pill: 999px;

  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.25);
  --gap: 14px;
  --panel-w: 330px;
  --font: 'Kantumruy Pro', 'Noto Sans Khmer', -apple-system, BlinkMacSystemFont,
          'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(59, 130, 246, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(242, 193, 78, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--gold); }
[hidden] { display: none !important; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ---------- app shell ---------- */

.app {
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  grid-template-rows: auto 1fr;
  gap: var(--gap);
  height: 100%;
  padding: var(--gap);
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 18px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: var(--gold-ink);
  font-size: 19px;
  box-shadow: 0 6px 16px -6px rgba(242, 193, 78, 0.6);
}

.brand h1 { margin: 0; font-size: 21px; line-height: 1.1; letter-spacing: -0.4px; }
.brand h1 span { color: var(--gold); }
.brand .tagline { display: block; font-size: 12px; color: var(--muted); }

.topbar-spacer { flex: 1; }

.badge {
  padding: 3px 10px;
  border-radius: var(--pill);
  background: var(--blue-soft);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #bcd3ff;
  font-size: 12px;
  font-weight: 600;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.card {
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.card:last-child { margin-bottom: 0; }

.map-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface);
}

#map { position: absolute; inset: 0; }

/* ---------- controls ---------- */

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }

.field > label,
.section-title {
  display: block;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder { color: #6b7ca3; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
textarea.input { min-height: 84px; resize: vertical; }
select.input { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.search-wrap { position: relative; flex: 1; max-width: 460px; }
.search-wrap .input { padding-left: 40px; border-radius: var(--pill); background: rgba(6, 15, 36, 0.7); }
.search-wrap::before {
  content: '⌕';
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-52%);
  color: var(--muted);
  font-size: 19px;
  pointer-events: none;
}

.inline { display: flex; gap: 8px; }
.inline .input { flex: 1; min-width: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: var(--pill);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover { border-color: var(--blue); background: #20396f; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-gold {
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  border-color: transparent;
  color: var(--gold-ink);
  box-shadow: 0 6px 18px -8px rgba(242, 193, 78, 0.7);
}

.btn-gold:hover { background: linear-gradient(180deg, #ffd36a, var(--gold)); border-color: transparent; }

.btn-blue { background: var(--blue-2); border-color: transparent; }
.btn-blue:hover { background: var(--blue); border-color: transparent; }

.btn-danger { background: transparent; border-color: rgba(248, 113, 113, 0.55); color: #fecaca; }
.btn-danger:hover { background: rgba(248, 113, 113, 0.14); border-color: var(--danger); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

.link-btn {
  padding: 4px 10px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--pill);
  color: var(--gold);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.link-btn:hover { background: var(--gold-soft); }

/* switch: <label class="switch"><input type="checkbox"><span></span> text</label> */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; }
/* Beats ".field > label" (uppercase caption style) for switches inside a field. */
.field > label.switch {
  display: flex;
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span {
  position: relative;
  flex: none;
  width: 40px;
  height: 23px;
  border-radius: var(--pill);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  transition: background 0.15s;
}
.switch span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #c9d5f0;
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + span { background: var(--gold-soft); border-color: var(--gold); }
.switch input:checked + span::after { transform: translateX(17px); background: var(--gold); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--gold-soft); }

/* ---------- category toggles (ChunkBase-style feature grid) ---------- */

.cat-head { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.cat-head .section-title { flex: 1; margin: 0; }

.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cat-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 8px 8px 7px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  user-select: none;
  opacity: 0.5;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}

.cat-chip:hover { opacity: 0.8; border-color: var(--line-2); }
.cat-chip input { position: absolute; opacity: 0; pointer-events: none; }
.cat-chip:has(input:checked) { opacity: 1; background: var(--surface-3); border-color: var(--line-2); }
.cat-chip:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--gold-soft); }

.cat-icon {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1;
  background: color-mix(in srgb, var(--c) 22%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 70%, transparent);
}

.cat-label { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.cat-label .km { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.cat-label { overflow-wrap: anywhere; }

/* Count sits as a badge on the icon's corner, leaving the label the full width. */
.cat-count {
  position: absolute;
  top: -7px;
  right: -9px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: var(--pill);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.cat-chip:has(input:checked) .cat-count { color: var(--gold); }

/* ---------- map overlays ---------- */

.map-badge {
  position: absolute;
  z-index: 5;
  padding: 7px 14px;
  /* Solid, not frosted: backdrop-filter makes Chrome on Windows render the
     text inside it soft. */
  background: #0b1834;
  border: 1px solid var(--line-2);
  border-radius: var(--pill);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.result-count { top: 12px; left: 12px; }
.result-count b { color: var(--gold); }

.coord-readout {
  bottom: 12px;
  left: 12px;
  color: var(--muted);
  cursor: pointer;
}

.coord-readout:hover { color: var(--text); border-color: var(--gold); }

.map-hint { bottom: 12px; right: 12px; color: var(--muted); font-size: 11.5px; }

/* Centred with auto margins rather than translate(-50%): a half-pixel
   offset blurs text. */
.map-toast {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  z-index: 20;
  width: fit-content;
  margin-inline: auto;
  padding: 9px 18px;
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  border-radius: var(--pill);
  color: var(--gold-ink);
  font-weight: 600;
  box-shadow: var(--shadow);
  translate: 0 -20px;
  opacity: 0;
  transition: opacity 0.18s, translate 0.18s;
  pointer-events: none;
}

.map-toast.show { translate: 0 0; opacity: 1; }

/* MapLibre controls, re-skinned */
.maplibregl-ctrl-group {
  background: rgba(8, 18, 42, 0.85) !important;
  border: 1px solid var(--line-2);
  border-radius: var(--r) !important;
  overflow: hidden;
  box-shadow: var(--shadow) !important;
}
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); }
.maplibregl-ctrl-group button:hover { background: var(--surface-3) !important; }
.maplibregl-ctrl-top-right { top: 6px; right: 6px; }
.maplibregl-ctrl-attrib {
  background: rgba(8, 18, 42, 0.7) !important;
  color: var(--muted);
  border-radius: var(--pill) !important;
}
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-attrib-inner { color: var(--muted) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
.maplibregl-ctrl-bottom-right { bottom: 40px; }

/* ---------- popup ---------- */

.maplibregl-popup-content {
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  color: var(--text);
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }

.maplibregl-popup-close-button {
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(6, 15, 36, 0.7);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}
.maplibregl-popup-close-button:hover { background: var(--surface-3); }

.pop { width: 280px; }
.pop img { display: block; width: 100%; height: 150px; object-fit: cover; background: var(--surface-2); }
.pop-body { padding: 13px 15px 15px; }
.pop-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--c) 18%, transparent);
  color: var(--c);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pop h3 { margin: 8px 0 1px; font-size: 17px; line-height: 1.25; padding-right: 22px; }
.pop .km-name { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.pop dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--r);
  font-size: 13px;
}
.pop dt { color: var(--muted); }
.pop dd { margin: 0; }
.pop .phones { display: flex; flex-direction: column; }
.pop .phones a { text-decoration: none; font-variant-numeric: tabular-nums; }
.pop .desc { margin: 8px 0 0; font-size: 13.5px; color: #cfdaf3; }
.pop .pop-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pop .pop-links a { text-decoration: none; }
.pop .coords { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.tag-verified {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: var(--pill);
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 10.5px;
  font-weight: 700;
  vertical-align: 2px;
}

.temp-pop { padding: 14px 16px; min-width: 210px; }
.temp-pop b { display: block; margin-bottom: 2px; font-size: 13px; }
.temp-pop .coords { margin-bottom: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- admin ---------- */

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-grid .span-2 { grid-column: 1 / -1; }

.login-screen {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}

.login-card .brand { margin-bottom: 18px; }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.msg {
  margin: 10px 0 0;
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: 13.5px;
}

.msg-error { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.5); }
.msg-ok    { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.45); }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.status-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--pill);
}

.status-tabs button {
  padding: 6px 4px;
  background: none;
  border: 0;
  border-radius: var(--pill);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.status-tabs button b { display: block; font-size: 15px; color: var(--text); }
.status-tabs button.active { background: var(--surface-3); color: var(--text); }
.status-tabs button.active b { color: var(--gold); }

.row-list { display: flex; flex-direction: column; gap: 6px; }

.row-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px 8px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
}

.row-item:hover  { border-color: var(--line-2); background: var(--surface-2); }
.row-item.active { border-color: var(--gold); background: var(--surface-2); }
.row-item .meta   { flex: 1; min-width: 0; }
.row-item .meta b { display: block; font-weight: 600; font-size: 13.5px; }
.row-item .meta small { color: var(--muted); font-size: 11.5px; }
.row-item .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty {
  padding: 22px 14px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.status-pill {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--pill);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-published { background: rgba(52, 211, 153, 0.14); color: var(--ok); }
.status-draft     { background: var(--gold-soft); color: var(--gold); }
.status-hidden    { background: rgba(147, 163, 199, 0.14); color: var(--muted); }

.photo-drop {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 120px;
  padding: 12px;
  background: var(--bg);
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
}

.photo-drop:hover { border-color: var(--gold); color: var(--text); }
.photo-drop img { width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--r); }
.photo-drop input { display: none; }

.pick-note {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  z-index: 6;
  width: fit-content;
  margin-inline: auto;
  padding: 9px 18px;
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  border-radius: var(--pill);
  color: var(--gold-ink);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.detail-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  width: 400px;
  max-width: calc(100% - 24px);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.detail-head h2 { flex: 1; margin: 0; font-size: 16px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.icon-btn:hover { border-color: var(--gold); }

.detail-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }

.detail-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

/* ---------- social: account, posts, composer ---------- */

a.brand, a.btn { color: inherit; text-decoration: none; }
a.btn-gold { color: var(--gold-ink); }
.post-head a { text-decoration: none; }

.avatar {
  flex: none;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  box-shadow: 0 0 0 2px var(--line-2);
}

.avatar-letter {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  color: #fff;
  font-weight: 700;
}

.account-menu { position: relative; }
.account-btn { display: block; padding: 0; background: none; border: 0; border-radius: 50%; cursor: pointer; }
.account-btn:hover .avatar { box-shadow: 0 0 0 2px var(--gold); }

.account-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 220px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.account-pop small { margin-top: -8px; color: var(--muted); }
.account-pop a { text-decoration: none; color: var(--text); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 8, 20, 0.72);
}

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  max-height: calc(100% - 16px);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-body { overflow-y: auto; padding: 18px; }

.signin-box p { margin: 0 0 6px; }
.signin-box .km { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.signin-box .google-slot { display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 12px; }
.signin-box .google-slot .inline { width: 100%; }

.post-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

.post {
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.post-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.post-head .status-pill { margin-left: auto; }
.post-who { flex: 1; min-width: 0; line-height: 1.3; }
.post-who small { display: block; color: var(--muted); font-size: 12px; }
.post-author { color: var(--text); font-weight: 600; text-decoration: none; }
.post-author:hover { color: var(--gold); }

.post-place {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  margin-top: 10px;
  padding: 3px 11px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.post-place span { color: var(--muted); font-weight: 400; }
.post-place:hover { background: color-mix(in srgb, var(--c) 28%, transparent); }

.post-rating { margin-top: 8px; }
.post-body { margin: 8px 0 0; white-space: pre-line; overflow-wrap: anywhere; color: #dbe4f8; }

.stars { color: var(--gold); letter-spacing: 1px; font-size: 15px; }
.stars-off { color: var(--surface-3); }

.post-photos {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  border-radius: var(--r);
  overflow: hidden;
}
.post-photos.n-1 { grid-template-columns: 1fr; }
.post-photos.n-2, .post-photos.n-4 { grid-template-columns: 1fr 1fr; }
.post-photos.n-3 { grid-template-columns: 1fr 1fr 1fr; }

.post-photo { position: relative; display: block; background: var(--bg); }
.post-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.post-photos.n-1 .post-photo img { aspect-ratio: auto; max-height: 420px; }
.post-photo .taken {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 8px;
  border-radius: var(--pill);
  background: rgba(6, 15, 36, 0.85);
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.post-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.post-date { flex: 1 1 auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--pill);
  color: var(--muted);
  cursor: pointer;
}
.like-btn .heart { font-size: 16px; line-height: 1; }
.like-btn:hover:not(:disabled) { border-color: #f472b6; color: var(--text); }
.like-btn.liked { border-color: rgba(244, 114, 182, 0.6); color: #f9a8d4; }
.like-btn.liked .heart { color: #f472b6; }
.like-btn:disabled { opacity: 0.5; cursor: default; }

.status-pending  { background: var(--gold-soft); color: var(--gold); }
.status-approved { background: rgba(52, 211, 153, 0.14); color: var(--ok); }
.status-rejected { background: rgba(248, 113, 113, 0.14); color: var(--danger); }

.pop-rating { margin: 2px 0 0; font-size: 13px; }
.pop .pop-links button { font-family: inherit; }

.reviews-summary { margin-bottom: 12px; font-size: 14px; }
.reviews-summary:empty { display: none; }
.reviews-summary span { color: var(--muted); }

/* composer */
.composer-place { margin: 0 0 14px; }
.composer-place .km { display: block; color: var(--muted); font-size: 14px; }

.star-input { display: flex; align-items: center; gap: 2px; }
.star-input button[data-star]:not(.link-btn) {
  padding: 0 3px;
  background: none;
  border: 0;
  color: var(--surface-3);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.1s, transform 0.1s;
}
.star-input button[data-star].on { color: var(--gold); }
.star-input button:not(.link-btn):hover { transform: scale(1.12); }
.star-input .link-btn { margin-left: 8px; }

.composer-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.photo-add, .photo-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r);
  overflow: hidden;
}

.photo-add {
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1.5px dashed var(--line-2);
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}
.photo-add small { display: block; margin-top: 4px; font-size: 11.5px; }
.photo-add:hover { border-color: var(--gold); color: var(--text); }
.photo-add input { display: none; }

.photo-tile { background: var(--surface-3) center / cover no-repeat; }
.photo-tile.uploading { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
.tile-status {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  padding: 2px 6px;
  border-radius: var(--pill);
  background: rgba(6, 15, 36, 0.85);
  font-size: 10.5px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: rgba(6, 15, 36, 0.85);
  border: 0;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
}

.safety-tip {
  display: flex;
  gap: 10px;
  margin: 4px 0 14px;
  padding: 11px 13px;
  background: var(--blue-soft);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--r);
  font-size: 13px;
}
.safety-tip > span { font-size: 18px; line-height: 1.2; }
.safety-tip p { margin: 0; }
.safety-tip .km { display: block; margin-top: 4px; color: #bcd3ff; }

.composer .btn-row { align-items: center; }
.composer .btn-row .hint { margin: 0; }

.sent { padding: 10px 0; text-align: center; }
.sent .btn-row { justify-content: center; }
.sent p { color: var(--muted); }
.sent a { text-decoration: none; }
.sent-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.14);
  color: var(--ok);
  font-size: 28px;
}

/* feed + profile pages: a normal scrolling page, not the map grid */
.page-body { height: auto; min-height: 100%; }
.page { max-width: 760px; margin: 0 auto; padding: var(--gap); }
.page .topbar { position: sticky; top: var(--gap); z-index: 30; }
.page-main { max-width: 620px; margin: 18px auto 40px; }

.feed-tabs, .view-tabs { grid-template-columns: 1fr 1fr; }
.review-tabs { grid-template-columns: repeat(3, 1fr); }
.feed-tabs button { font-size: 14px; }
.feed-tabs button small { display: block; font-size: 11px; font-weight: 400; }

.count-dot {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: var(--pill);
  background: var(--gold);
  color: var(--gold-ink);
  font-size: 10.5px;
  line-height: 16px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}
.profile-info { flex: 1; min-width: 0; }
.profile-info h2 { margin: 0; font-size: 22px; overflow-wrap: anywhere; }
.profile-handle { margin: 2px 0 10px; color: var(--muted); font-size: 13px; }
.profile-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); }
.profile-stats b { color: var(--text); }
.profile-card > .empty { flex: 1; }

/* ---------- mobile ---------- */

.panel-toggle { display: none; }

@media (max-width: 820px) {
  :root { --gap: 10px; }

  .app {
    grid-template-columns: 100%;
    grid-template-rows: auto 1fr auto;
  }

  .topbar { flex-wrap: wrap; padding: 10px 12px; gap: 10px; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .brand .tagline { display: none; }

  .map-wrap { grid-row: 2; }

  .panel { grid-row: 3; max-height: 50vh; }
  .panel.collapsed .panel-scroll { display: none; }

  .panel-toggle {
    display: block;
    width: 100%;
    padding: 11px;
    background: var(--surface-2);
    border: 0;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
  }

  .admin-grid { grid-template-columns: 1fr; }
  .pop { width: min(74vw, 280px); }
  .map-hint { display: none; }
  .detail-panel { top: 8px; right: 8px; bottom: 8px; max-width: calc(100% - 16px); }

  /* On a phone the map area is too short for the reviews panel. */
  #reviewsPanel { position: fixed; inset: 8px; z-index: 50; width: auto; max-width: none; }

  .page .topbar { flex-wrap: nowrap; }
  .page .topbar .btn { padding: 8px 12px; }
  .profile-card { flex-wrap: wrap; padding: 16px; }
  .profile-actions { flex-basis: 100%; }
  .profile-actions .btn { width: 100%; }
}
