/* ============================================================================
   campo — cartographic / functional UI

   The map is the instrument; chrome is the quiet ground around it. Warm light
   neutrals (faint clay tint, hue ~70, near-zero chroma — never pure #000/#fff),
   a single restrained clay accent for action and selection, system fonts for UI
   and system mono for the "map sheet" voice. Color is OKLCH. No web fonts, no
   third-party requests.

   Deliberately NOT green: an organic-food directory in leaf-green reads as the
   crunchy-wellness cliché the brand avoids (PRODUCT.md anti-reference). The
   ground is warm paper; the accent is clay (PR earth), not kale. Success stays
   green as a semantic, distinct from the accent.

   Trust tiers are non-color-redundant: filled teal disc = registrado, hollow
   ochre ring = independiente, and a text label always travels with the cue, so
   meaning survives grayscale and color blindness (WCAG AA).
   ========================================================================== */

:root {
  color-scheme: light;

  /* neutrals — warm light, faint clay tint (hue ~70), near-zero chroma. paper is
     the page ground, surface the raised chrome (near-white), sunk the recessed
     wells (map ground, thumbnails). Never pure #fff. */
  --paper:        oklch(0.96 0.010 75);
  --surface:      oklch(0.99 0.006 75);
  --surface-sunk: oklch(0.93 0.013 70);
  --ink:          oklch(0.26 0.014 60);
  --ink-2:        oklch(0.42 0.015 60);
  --ink-3:        oklch(0.55 0.013 65);
  --line:         oklch(0.88 0.012 72);
  --line-strong:  oklch(0.81 0.015 72);

  /* accent — clay / terracotta (PR earth). Fills use --accent (dark enough that
     --on-accent white text clears AA on it); text/borders on the light ground
     use --accent-strong. */
  --accent:        oklch(0.49 0.13 42);
  --accent-strong: oklch(0.45 0.12 42);
  --accent-weak:   oklch(0.93 0.035 55);
  --accent-line:   oklch(0.76 0.09 48);
  --on-accent:     oklch(0.98 0.012 75);

  /* trust tiers (legend dots; pins themselves are hex in config.js). Darkened so
     they read against the light chrome. */
  --tier-registrado:    oklch(0.52 0.12 200); /* teal */
  --tier-independiente: oklch(0.62 0.13 75);  /* ochre */

  /* semantic — success stays green (now distinct from the clay accent),
     darkened for legibility on light */
  --ok:          oklch(0.50 0.13 150);
  --ok-weak:     oklch(0.93 0.045 150);
  --danger:      oklch(0.52 0.19 27);
  --danger-weak: oklch(0.94 0.05 27);
  --warn-weak:   oklch(0.95 0.06 80);
  --warn-line:   oklch(0.78 0.11 80);
  --warn-ink:    oklch(0.45 0.10 80);

  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  /* type scale — ~1.28 ratio with deliberate jumps at the top so headings carry
     hierarchy (a flat scale reads "unstyled"). */
  --t-xs: 0.75rem;
  --t-sm: 0.85rem;
  --t-base: 0.95rem;
  --t-md: 1.05rem;
  --t-lg: 1.3rem;
  --t-xl: 1.7rem;

  /* Sharp by intent: rectilinear like a technical drawing. Controls square,
     containers barely softened. */
  --r-sm: 0;
  --r: 0;
  --r-lg: 2px;
  --topbar-h: 2.9rem;
  --shadow-sm: 0 1px 2px oklch(0.30 0.02 60 / 0.10);
  --shadow:    0 1px 2px oklch(0.30 0.02 60 / 0.08), 0 6px 20px oklch(0.30 0.02 60 / 0.12);
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent-strong); }

/* state transitions: color/feedback only, never layout */
button, a, select, input, textarea,
.maplibregl-popup-close-button, .edit-toggle, #admin-nav button {
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---- public top bar ------------------------------------------------------ */
#topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  min-height: 2.9rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  padding: 0.35rem 0.9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
}

#site-title {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#site-title { flex: 0 1 auto; }
.controls { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }

/* about + "add your business" pinned to the far right; margin-left:auto eats the
   row's free space so they sit flush against the edge, not mid-row. */
.topbar-actions { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; }

/* search box: a single bordered unit, borderless input + icon submit */
.searchbar {
  display: flex;
  align-items: stretch;
  flex: 1 1 12rem;
  max-width: 26rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  overflow: hidden;
}
.searchbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
#search-q {
  flex: 1; min-width: 0;
  font: inherit; font-size: var(--t-sm);
  padding: 0.3rem 0.5rem;
  border: none; background: transparent; color: var(--ink);
}
#search-q:focus-visible { outline: none; }
#search-go {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 0.55rem;
  border: none; border-left: 1px solid var(--line);
  background: var(--surface-sunk); color: var(--ink-2);
  cursor: pointer;
}
#search-go:hover { background: var(--accent); color: var(--on-accent); }

#category, #tier {
  font: inherit;
  font-size: var(--t-sm);
  padding: 0.3rem 0.45rem;
  max-width: 11rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
}

#locate {
  font: inherit; font-size: var(--t-sm);
  padding: 0.3rem 0.55rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  cursor: pointer;
  white-space: nowrap;
}
#locate:hover { border-color: var(--accent-line); color: var(--accent-strong); }

#about-link, #support-link {
  font-size: var(--t-sm);
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.3rem 0.2rem;
  white-space: nowrap;
}
#about-link:hover, #support-link:hover { color: var(--accent-strong); text-decoration: underline; }
/* support gets the accent so the one "ask" reads as a quiet call to action */
#support-link { color: var(--accent-strong); font-weight: 600; }

#lang-toggle {
  font-family: var(--mono);
  font-weight: 600;
  font-size: var(--t-sm);
  padding: 0.3rem 0.5rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  cursor: pointer;
}
#lang-toggle:hover { border-color: var(--accent-line); color: var(--accent-strong); }

#open-submit {
  font: inherit;
  font-weight: 600;
  font-size: var(--t-sm);
  padding: 0.32rem 0.6rem;
  border: 1px solid var(--accent);
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--r);
  cursor: pointer;
  white-space: nowrap;
}
#open-submit:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

#map {
  position: absolute;
  inset: var(--topbar-h) 0 0 0;
  background: var(--surface-sunk);
}

#basemap-note {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 10;
  padding: 0.35rem 0.7rem;
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}

/* ---- MapLibre control + popup chrome ------------------------------------- */
.maplibregl-ctrl-group {
  border: 1px solid var(--line-strong) !important;
  border-radius: var(--r) !important;
  box-shadow: var(--shadow-sm) !important;
  background: var(--surface) !important;
}
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }

.maplibregl-popup-content {
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* tip is a CSS triangle: only the visible edge has width, so tinting all
   border-colors safely matches the popup surface regardless of anchor. */
.maplibregl-popup-tip { border-color: var(--surface); }
.maplibregl-popup-close-button {
  width: 1.7rem; height: 1.7rem;
  font-size: 1.15rem; line-height: 1;
  color: var(--ink-3);
  border-radius: var(--r-sm);
}
.maplibregl-popup-close-button:hover { background: var(--surface-sunk); color: var(--ink); }

/* ---- popup body ---------------------------------------------------------- */
.popup { padding: 0.65rem 0.75rem 0.7rem; max-width: 280px; font-size: var(--t-sm); }
.popup h3 { margin: 0 0 0.45rem; font-size: var(--t-lg); font-weight: 700; line-height: 1.2; color: var(--ink); }
.popup .badges { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }

.popup-imgs { display: flex; gap: 0.3rem; overflow-x: auto; margin: 0 0 0.55rem; padding-bottom: 0.1rem; }
.popup-imgs img {
  height: 88px; width: auto; flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  object-fit: cover;
  background: var(--surface-sunk);
}

.popup .cats { margin: 0 0 0.4rem; font-family: var(--mono); font-size: var(--t-xs); letter-spacing: 0.01em; color: var(--ink-2); }
.popup .desc { margin: 0 0 0.45rem; font-size: var(--t-sm); line-height: 1.5; color: var(--ink); }
.popup .muni { margin: 0 0 0.3rem; font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-3); }
.popup .hours { margin: 0 0 0.3rem; font-size: var(--t-xs); color: var(--ink-2); }
.popup .links {
  margin: 0.55rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
  font-size: var(--t-sm);
  display: flex; flex-wrap: wrap; gap: 0.1rem 0.7rem;
}
.popup .links a { color: var(--accent-strong); text-decoration: none; font-weight: 600; }
.popup .links a:hover { text-decoration: underline; }

/* directions: opens the device's native maps (see app.js mapsURL) */
.popup .dir { margin: 0.5rem 0 0; }
.popup .dir a {
  display: inline-block;
  font-weight: 600; font-size: var(--t-sm);
  padding: 0.32rem 0.7rem;
  color: var(--accent-strong);
  background: var(--surface);
  border: 1px solid var(--accent);
  text-decoration: none;
}
.popup .dir a:hover { background: var(--accent-weak); }

/* operator contact: deliberately quiet — a footnote, not a call to action */
.popup .report { margin: 0.55rem 0 0; font-size: var(--t-xs); }
.popup .report a { color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; }
.popup .report a:hover { color: var(--accent-strong); }

/* transient notice (search misses, geolocation errors) */
#toast {
  position: fixed;
  left: 50%; bottom: 3.2rem;
  transform: translateX(-50%);
  z-index: 40;
  max-width: 80vw;
  padding: 0.45rem 0.85rem;
  font-size: var(--t-sm);
  color: var(--on-accent);
  background: var(--ink);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

/* ---- trust-tier + sponsor chips (shared: popup + admin) ------------------ */
/* Legend-style chip: tinted ground, a tier dot, ink text + text label. The
   dot mirrors the map pin — filled disc for registrado, ring for independiente. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--t-xs);
  font-weight: 600;
  line-height: 1.3;
  padding: 0.16rem 0.5rem;
  color: var(--ink-2);
  background: var(--surface-sunk);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 0.55em; height: 0.55em;
  border-radius: 50%;
  background: var(--badge-dot, var(--ink-3));
  flex: 0 0 auto;
}
.badge-negocio_registrado { --badge-dot: var(--tier-registrado); }
.badge-vendedor_independiente::before {
  background: transparent;
  border: 1.5px solid var(--tier-independiente);
}
.badge-sponsor {
  color: var(--accent-strong);
  background: var(--accent-weak);
  border-color: var(--accent-line);
  --badge-dot: var(--accent);
}

/* ---- popup claim / edit affordance --------------------------------------- */
.popup .claim { margin-top: 0.55rem; padding-top: 0.55rem; border-top: 1px solid var(--line); }
.claim-prompt {
  font: inherit; font-weight: 600;
  width: 100%;
  padding: 0.45rem 0.6rem;
  color: var(--accent-strong);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--r);
  cursor: pointer;
}
.claim-prompt:hover { background: var(--accent-weak); }
.claim-form { margin: 0; }
.claim-intro { margin: 0 0 0.4rem; font-size: var(--t-xs); color: var(--ink-2); }
.claim-form input {
  font: inherit; width: 100%;
  padding: 0.45rem 0.5rem; margin-bottom: 0.4rem;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface);
}
.claim-form button {
  font: inherit; font-weight: 600;
  padding: 0.45rem 0.8rem;
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--r);
  cursor: pointer;
}
.claim-form button:hover { background: var(--accent-strong); }
.claim-form button:disabled { opacity: 0.55; cursor: default; }
.claim-msg { margin: 0.4rem 0 0; font-size: var(--t-sm); }
.claim-msg.ok { color: var(--ok); }
.claim-msg.err { color: var(--danger); }

/* ---- claim verify landing page ------------------------------------------- */
.claim-page { display: flex; min-height: 100%; align-items: center; justify-content: center; padding: 1rem; background: var(--paper); }
#claim-box {
  max-width: 28rem; width: 100%;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 1.8rem 1.6rem;
  box-shadow: var(--shadow-sm);
}
#claim-box h1 { font-size: var(--t-xl); margin: 0 0 0.8rem; }
#claim-box #claim-status { font-size: var(--t-md); margin: 0 0 1rem; color: var(--ink-2); }
#claim-box #claim-status.ok { color: var(--ok); }
#claim-box #claim-status.err { color: var(--danger); }
#claim-box #claim-back { color: var(--accent-strong); text-decoration: none; font-weight: 600; }

/* ---- owner edit landing page --------------------------------------------- */
.edit-page { background: var(--paper); }
.edit-page #edit-box { max-width: 36rem; margin: 1.5rem auto; padding: 0 1rem 2rem; }
.edit-page #edit-box h1 { font-size: var(--t-xl); }
#edit-status.ok { color: var(--ok); font-weight: 600; }
#edit-status.err { color: var(--danger); font-weight: 600; }
#edit-form .checks { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; }
#edit-form textarea { font: inherit; width: 100%; padding: 0.45rem 0.5rem; border: 1px solid var(--line-strong); border-radius: var(--r); }
#edit-save {
  font: inherit; font-weight: 600;
  margin-top: 0.6rem; padding: 0.55rem 1.1rem;
  color: var(--on-accent); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--r); cursor: pointer;
}
#edit-save:hover { background: var(--accent-strong); }
#edit-save:disabled { opacity: 0.55; cursor: default; }
#edit-back { color: var(--accent-strong); text-decoration: none; font-weight: 600; }

/* ---- diff table (admin pending edits) ------------------------------------ */
table.diff { width: 100%; border-collapse: collapse; margin: 0.4rem 0 0.2rem; font-size: var(--t-sm); }
table.diff th, table.diff td { text-align: left; padding: 0.3rem 0.45rem; vertical-align: top; border-top: 1px solid var(--line); }
table.diff thead th {
  border-top: none;
  font-family: var(--mono); font-size: var(--t-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3);
}
table.diff tbody th { color: var(--ink-2); font-weight: 600; white-space: nowrap; }
table.diff .diff-old { color: var(--danger); text-decoration: line-through; }
table.diff .diff-new { color: var(--ok); font-weight: 600; }

/* ---- submission panel ---------------------------------------------------- */
#submit-panel {
  position: fixed;
  top: var(--topbar-h); right: 0; bottom: 0;
  width: 380px; max-width: 100%;
  z-index: 20;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
#submit-form { padding: 1.1rem 1.15rem 2rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.2rem; }
.panel-head h2 { margin: 0; font-size: var(--t-lg); }
#close-submit {
  font-size: 1.5rem; line-height: 1;
  padding: 0 0.2rem;
  border: none; background: none; color: var(--ink-3); cursor: pointer;
}
#close-submit:hover { color: var(--ink); }
#submit-form .intro { font-size: var(--t-xs); color: var(--ink-2); margin: 0.2rem 0 1rem; }

.field { display: block; margin-bottom: 0.5rem; }
.field > span { display: block; font-size: var(--t-sm); font-weight: 600; margin-bottom: 0.2rem; color: var(--ink-2); }
.field input, .field textarea {
  font: inherit; width: 100%;
  padding: 0.35rem 0.45rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
}
.field input:hover, .field textarea:hover { border-color: var(--ink-3); }
textarea { resize: vertical; }

#submit-form fieldset {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin: 0 0 0.85rem;
  padding: 0.6rem 0.75rem 0.75rem;
}
#submit-form legend { font-size: var(--t-sm); font-weight: 700; padding: 0 0.35rem; color: var(--ink); }
label.inline { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0.2rem 0.7rem 0.2rem 0; font-size: var(--t-sm); }
.checks { display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; }
.help { font-size: var(--t-xs); color: var(--ink-3); margin: 0.35rem 0 0; }

#pick-location {
  font: inherit; font-weight: 600;
  padding: 0.45rem 0.7rem;
  color: var(--accent-strong);
  background: var(--surface);
  border: 1px solid var(--accent); border-radius: var(--r); cursor: pointer;
}
#pick-location:hover { background: var(--accent-weak); }
#location-status { display: block; font-size: var(--t-sm); color: var(--ok); margin-top: 0.3rem; }

/* contact-links editor (shared: submit form + admin edit drawer) */
.links-rows { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }
.link-row { display: flex; gap: 0.35rem; align-items: center; }
.link-row .link-platform,
.link-row .link-url {
  font: inherit; font-size: var(--t-sm);
  padding: 0.35rem 0.4rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r);
}
.link-row .link-platform { flex: 0 0 auto; }
.link-row .link-url { flex: 1; min-width: 0; }
.link-row .link-del {
  flex: 0 0 auto; width: 1.8rem; height: 1.8rem; line-height: 1;
  font-size: 1.1rem; cursor: pointer;
  color: var(--ink-3); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r);
}
.link-row .link-del:hover { border-color: var(--danger); color: var(--danger); }
.link-add {
  font: inherit; font-size: var(--t-sm); font-weight: 600;
  padding: 0.35rem 0.7rem;
  color: var(--accent-strong); background: var(--surface);
  border: 1px solid var(--accent-line); border-radius: var(--r); cursor: pointer;
}
.link-add:hover { background: var(--accent-weak); }
.loc-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
#clear-location {
  font: inherit; font-weight: 600;
  padding: 0.45rem 0.7rem;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer;
}
#clear-location:hover { border-color: var(--danger); color: var(--danger); }

#pick-banner {
  position: fixed;
  top: calc(var(--topbar-h) + 0.5rem); left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 0.5rem 1rem;
  color: var(--on-accent); background: var(--accent);
  border-radius: var(--r); font-size: var(--t-sm);
  box-shadow: var(--shadow);
}

/* honeypot: off-screen, never shown to humans */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- search results panel (relevance-ranked) ----------------------------- */
/* display:flex below would beat the UA [hidden]{display:none} rule, so the
   panel must hide explicitly. */
#results-panel[hidden] { display: none; }
#results-panel {
  position: fixed;
  top: calc(var(--topbar-h) + 0.5rem);
  left: 0.5rem;
  z-index: 20;
  width: 320px; max-width: calc(100% - 1rem);
  max-height: calc(100% - var(--topbar-h) - 1rem);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.results-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: var(--t-xs); font-weight: 600;
  letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-3);
}
#results-close {
  font-size: 1.3rem; line-height: 1; padding: 0 0.2rem;
  border: none; background: none; color: var(--ink-3); cursor: pointer;
}
#results-close:hover { color: var(--ink); }
#results-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
#results-list li + li { border-top: 1px solid var(--line); }
.result-row {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; text-align: left;
  padding: 0.5rem 0.7rem;
  font: inherit; color: var(--ink);
  background: none; border: none; cursor: pointer;
}
.result-row:hover, .result-row:focus-visible { background: var(--surface-sunk); outline: none; }
.result-row .r-text { flex: 1; min-width: 0; }
.result-row .r-name { display: block; font-weight: 600; font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-row .r-meta { display: block; font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-3); margin-top: 0.1rem; }
.result-row .r-chev { flex: 0 0 auto; color: var(--ink-3); }

.form-msg { padding: 0.5rem 0.7rem; border-radius: var(--r); font-size: var(--t-sm); margin: 0.5rem 0; border: 1px solid transparent; }
.form-msg.ok { background: var(--ok-weak); color: var(--ok); border-color: var(--ok); }
.form-msg.err { background: var(--danger-weak); color: var(--danger); border-color: var(--danger); }
.form-actions { display: flex; gap: 0.6rem; margin-top: 0.6rem; }
#submit-btn {
  font: inherit; font-weight: 600;
  padding: 0.55rem 1.1rem;
  color: var(--on-accent); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--r); cursor: pointer;
}
#submit-btn:hover { background: var(--accent-strong); }
#submit-btn:disabled { opacity: 0.55; cursor: default; }
#cancel-submit {
  font: inherit;
  padding: 0.55rem 0.9rem;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer;
}
#cancel-submit:hover { border-color: var(--ink-3); }

/* ============================================================================
   admin (back-office)
   ========================================================================== */
body.admin { background: var(--paper); }
body.admin #topbar {
  position: static;
  height: auto;
  padding: 0.7rem 1rem;
  flex-wrap: wrap;
}
body.admin #topbar h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: var(--t-md);
  font-weight: 600;
  letter-spacing: 0.03em;
}
#admin-main { max-width: 820px; margin: 0 auto; padding: 1rem 1rem 3rem; }

#login {
  max-width: 28rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
}
#login p { margin-top: 0; color: var(--ink-2); }
#login input {
  font: inherit;
  padding: 0.55rem;
  width: 22rem; max-width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  margin-right: 0.5rem;
}
#login button, #save-token {
  font: inherit; font-weight: 600;
  padding: 0.5rem 0.95rem;
  color: var(--on-accent); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--r); cursor: pointer;
}
#login button:hover, #save-token:hover { background: var(--accent-strong); }
#logout {
  font: inherit; font-weight: 600;
  padding: 0.45rem 0.9rem;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer;
}
#logout:hover { border-color: var(--ink-3); color: var(--ink); }
.error { color: var(--danger); }

/* segmented nav */
#admin-nav {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  overflow: hidden;
}
#admin-nav button {
  font: inherit; font-size: var(--t-sm);
  padding: 0.4rem 0.85rem;
  color: var(--ink-2);
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--line);
  cursor: pointer;
}
#admin-nav button:last-child { border-right: none; }
#admin-nav button:hover { background: var(--surface-sunk); }
#admin-nav button.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* review / listing cards */
.review-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.7rem;
  box-shadow: var(--shadow-sm);
}
.review-card h3 { margin: 0 0 0.3rem; font-size: var(--t-lg); }
.review-card .meta { margin: 0.25rem 0; font-size: var(--t-sm); color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.review-card .cats { margin: 0.25rem 0; font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-2); }
.review-card .desc { margin: 0.4rem 0; font-size: var(--t-base); line-height: 1.55; }
.review-card .desc.en { color: var(--ink-2); }
.review-card .contact, .review-card .refs { margin: 0.25rem 0; font-size: var(--t-sm); color: var(--ink-2); }
.review-card .created { margin: 0.4rem 0 0.7rem; font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-3); }
.review-card .claim-flag {
  margin: 0.3rem 0 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--warn-weak);
  border: 1px solid var(--warn-line);
  border-radius: var(--r);
  font-size: var(--t-sm); font-weight: 600; color: var(--warn-ink);
}
.review-card .claim-flag small { font-weight: 400; color: var(--ink-2); }

.actions { display: flex; gap: 0.5rem; margin-top: 0.2rem; }
.actions button {
  font: inherit; font-weight: 600;
  padding: 0.38rem 0.8rem;
  border-radius: var(--r); cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line-strong);
}
.actions .approve, .sponsor-ctl .approve, .admin-edit-form button.approve {
  color: var(--on-accent); background: var(--accent); border-color: var(--accent);
}
.actions .approve:hover, .sponsor-ctl .approve:hover, .admin-edit-form button.approve:hover { background: var(--accent-strong); }
.actions .reject { color: var(--danger); background: var(--surface); border-color: var(--danger); }
.actions .reject:hover { background: var(--danger-weak); }

/* sponsor management */
#sponsor-search { display: flex; gap: 0.5rem; margin-bottom: 1.1rem; }
#sponsor-search input { font: inherit; flex: 1; padding: 0.5rem 0.6rem; border: 1px solid var(--line-strong); border-radius: var(--r); }
#sponsor-search button {
  font: inherit; font-weight: 600;
  padding: 0.5rem 0.95rem;
  color: var(--on-accent); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--r); cursor: pointer;
}
#sponsor-search button:hover { background: var(--accent-strong); }
.sponsor-card .expired { font-size: var(--t-xs); color: var(--danger); font-weight: 600; }
.sponsor-ctl {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem;
  margin-top: 0.7rem; padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}
.sponsor-ctl label.inline { margin: 0; }
.sponsor-ctl input[type="date"] { font: inherit; padding: 0.3rem 0.45rem; border: 1px solid var(--line-strong); border-radius: var(--r); }
.sponsor-ctl input[type="date"]:disabled { opacity: 0.5; }
.sponsor-msg { color: var(--ok); font-weight: 600; }

/* admin direct-edit (v1 manual mode) */
.edit-toggle {
  font: inherit; font-weight: 600; font-size: var(--t-sm);
  margin-top: 0.7rem; padding: 0.4rem 0.85rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer;
}
.edit-toggle:hover { border-color: var(--accent-line); color: var(--accent-strong); }
.admin-edit-host { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px dashed var(--line-strong); }
.admin-edit-form .field { margin-bottom: 0.6rem; }
.admin-edit-form textarea { font: inherit; width: 100%; padding: 0.45rem 0.5rem; border: 1px solid var(--line-strong); border-radius: var(--r); }
.admin-edit-form .checks { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; }
.admin-edit-form button.approve { margin-top: 0.4rem; }

/* admin image manager (inside the edit drawer) */
.img-mgr { margin-bottom: 0.9rem; }
.img-mgr .field-label { display: block; font-weight: 600; font-size: var(--t-sm); margin-bottom: 0.4rem; color: var(--ink-2); }
.img-list { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.5rem; }
.img-thumb {
  position: relative; margin: 0;
  width: 92px; height: 92px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-sunk);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb .img-state { font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-3); text-align: center; padding: 0 0.2rem; }
.img-thumb.failed { border-color: var(--danger); }
.img-thumb.failed .img-state { color: var(--danger); }
.img-del {
  position: absolute; top: 2px; right: 2px;
  width: 19px; height: 19px; line-height: 17px; padding: 0;
  border: none;
  background: oklch(0.12 0.012 60 / 0.66); color: oklch(0.96 0.005 75);
  font-size: 0.95rem; cursor: pointer;
}
.img-del:hover { background: var(--danger); }
.img-msg { margin: 0.25rem 0 0; font-size: var(--t-xs); color: var(--ink-2); }
.img-msg.err { color: var(--danger); }

/* ---- static document page (about / privacy) ------------------------------ */
.doc { max-width: 40rem; margin: 0 auto; padding: 1.4rem 1.2rem 3rem; }
.doc .topline { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.doc .topline a { color: var(--accent-strong); text-decoration: none; font-weight: 600; font-size: var(--t-sm); }
.doc .topline a:hover { text-decoration: underline; }
.doc #about-lang {
  font-family: var(--mono); font-weight: 600; font-size: var(--t-sm);
  padding: 0.3rem 0.55rem;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer;
}
.doc h1 { font-size: var(--t-xl); margin: 0 0 0.2rem; }
.doc .lede { color: var(--ink-2); font-size: var(--t-md); margin: 0 0 0.5rem; }
.doc h2 { font-size: var(--t-md); margin: 1.3rem 0 0.3rem; }
.doc p { line-height: 1.6; margin: 0.3rem 0; }
.doc strong { font-weight: 600; }

/* Admin inherits the single warm-clay theme from :root — no separate palette.
   The :root color-scheme:light already makes native controls (date picker, select)
   render legibly on the light surface, public and admin alike. */

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 560px) {
  #site-title { font-size: 0.72rem; letter-spacing: 0.02em; }
  #submit-panel { width: 100%; }
  #open-submit { padding: 0.4rem 0.5rem; }
  #category { max-width: 34vw; }
}
