/* Sition admin — monochrome. Share-card samples (.sc) are the only colorful element. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e2e2e2;
  --surface: #f5f5f5;
  --focus: #0a0a0a;
  --danger: #0a0a0a;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --fg: #f2f2f2;
    --muted: #9a9a9a;
    --line: #2a2a2a;
    --surface: #151515;
    --focus: #f2f2f2;
    --danger: #f2f2f2;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); }
a { color: inherit; text-underline-offset: 3px; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.75rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--fg); color: var(--bg); padding: 0.5rem 0.75rem; z-index: 10; }
.skip-link:focus { left: 0.5rem; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Header */
.topbar { border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 0.75rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand { font-weight: 800; letter-spacing: 0.02em; text-decoration: none; }
.brand span { font-weight: 400; color: var(--muted); }
.nav { display: flex; gap: 0.25rem; flex-wrap: wrap; flex: 1; }
.nav a { text-decoration: none; padding: 0.4rem 0.7rem; border-radius: 999px; color: var(--muted); }
.nav a:hover { color: var(--fg); }
.nav a[aria-current="page"] { background: var(--fg); color: var(--bg); }
.who { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--muted); }

main { max-width: 1120px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
@media (max-width: 600px) {
  .nav { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
}
.page-head h1 { margin: 0; }
.back { display: inline-block; margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--muted); }

/* Flash + errors */
.flash, .error-summary {
  border: 1px solid var(--fg); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1.25rem;
}
.flash { background: var(--surface); }
.error-summary { border-width: 2px; }
.error-summary h2 { margin: 0 0 0.5rem; font-size: 1rem; }
.error-summary ul { margin: 0; padding-left: 1.2rem; }
.field-error { display: block; font-size: 0.875rem; font-weight: 600; margin-top: 0.25rem; }
.field-error::before { content: "⚠︎ "; }

/* Buttons */
.btn, button {
  font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 40px; padding: 0.45rem 0.95rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--fg); background: var(--fg); color: var(--bg); text-decoration: none; white-space: nowrap;
}
.btn-secondary, button.btn-secondary { background: transparent; color: var(--fg); }
.btn-ghost, button.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-small, button.btn-small { min-height: 32px; padding: 0.2rem 0.65rem; font-size: 0.875rem; }
.btn-icon, button.btn-icon { min-width: 32px; min-height: 32px; padding: 0; border-color: var(--line); background: transparent; color: var(--fg); }
button[disabled] { opacity: 0.35; cursor: not-allowed; }
.btn-danger, button.btn-danger { background: transparent; color: var(--danger); border-width: 2px; font-weight: 600; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 1.5rem; }
.inline-form { display: inline; margin: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.stat-value { display: block; font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.9rem; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
caption { text-align: left; padding: 0.75rem 1rem; font-weight: 700; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-top: 1px solid var(--line); vertical-align: middle; }
thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; background: var(--surface); }
.table-wrap + .table-wrap { margin-top: 1.5rem; }
td.num { font-variant-numeric: tabular-nums; }
.cell-row { display: flex; gap: 0.35rem; align-items: center; }
.thumb { width: 44px; }
.thumb .sc { border-radius: 6px; }
.badge {
  display: inline-block; font-size: 0.78rem; padding: 0.1rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge-live { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.badge-soon { border-color: var(--fg); color: var(--fg); }
.toggle[aria-pressed="false"] { background: transparent; color: var(--muted); border-color: var(--line); }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); }

/* Forms */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }
.preview-pane { position: sticky; top: 1rem; }
.preview-pane .sc { max-width: 300px; }
@media (max-width: 860px) {
  .form-layout { grid-template-columns: 1fr; }
  .preview-pane { position: static; order: -1; }
  .preview-pane .sc { max-width: 200px; margin: 0 auto; }
}
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; min-width: 0; }
legend { font-weight: 700; padding: 0 0.35rem; }
.field { margin-bottom: 0.9rem; }
.field:last-child { margin-bottom: 0; }
.field > label, .field-label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.hint { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }
.colors { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.colors .field { margin: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  font: inherit; width: 100%; min-height: 42px; padding: 0.45rem 0.65rem; border: 1px solid var(--muted);
  border-radius: 8px; background: var(--bg); color: var(--fg);
}
textarea { resize: vertical; line-height: 1.4; }
textarea.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.8rem; }
textarea[aria-invalid="true"] { border: 2px solid var(--fg); }
input[type="color"] { width: 64px; height: 42px; padding: 2px; border: 1px solid var(--muted); border-radius: 8px; background: var(--bg); }
input[type="file"] { font: inherit; max-width: 100%; }
input[aria-invalid="true"], select[aria-invalid="true"] { border: 2px solid var(--fg); }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--fg); }
.radio-row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.radio-row label { display: flex; gap: 0.4rem; align-items: center; font-weight: 400; }
.radio-row input { width: 18px; height: 18px; accent-color: var(--fg); }
.current-image { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.5rem; }
.current-image img { width: 56px; height: 112px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; margin-bottom: 0.75rem; }
.lang-switch a, .lang-switch button { border: 0; min-height: 30px; padding: 0.15rem 0.75rem; border-radius: 999px; background: transparent; color: var(--muted); text-decoration: none; font-size: 0.875rem; }
.lang-switch [aria-current="true"], .lang-switch [aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* Login */
.login { max-width: 380px; margin: 10vh auto 0; }
.login h1 { font-size: 1.4rem; }

/* Preview page */
.preview-page { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 760px) { .preview-page { grid-template-columns: 1fr; } }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }
.swatch { display: inline-block; width: 1em; height: 1em; border-radius: 3px; border: 1px solid var(--line); vertical-align: -0.15em; margin-right: 0.25rem; }

/* ------------------------------------------------------------------------ */
/* Share card sample (1:2). Sizes in cqw scale with the card width.          */
/* ------------------------------------------------------------------------ */
.sc {
  container-type: inline-size; position: relative; width: 100%; aspect-ratio: 1 / 2; overflow: hidden;
  border-radius: 14px; isolation: isolate; font-family: system-ui, -apple-system, sans-serif;
  box-shadow: 0 0 0 1px var(--line);
}
.sc-layer { position: absolute; inset: 0; pointer-events: none; }
.sc-image { background-position: center; background-size: cover; background-repeat: no-repeat; z-index: 0; }
.sc-pattern { z-index: 1; }
.sc-pattern-grain { mix-blend-mode: overlay; opacity: 0.55; }
.sc-body {
  position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column;
  padding: 9cqw 8cqw 8cqw; gap: 5cqw;
}
.sc-head { display: flex; align-items: center; gap: 3cqw; min-height: 10cqw; }
.sc-emoji { font-size: 10cqw; line-height: 1; }
.sc-title { font-size: 8.5cqw; font-weight: 800; line-height: 1.05; color: var(--sc-accent); letter-spacing: -0.01em; }
.sc-photo {
  width: 100%; aspect-ratio: 1; border-radius: 5cqw; flex: none;
  background: linear-gradient(160deg, #9a9a9a, #3c3c3c); box-shadow: 0 0 0 0.8cqw var(--sc-accent);
}
.sc-meta { display: flex; flex-direction: column; gap: 1.2cqw; }
.sc-user { font-size: 6cqw; font-weight: 800; }
.sc-caption { font-size: 5cqw; }
.sc-line { font-size: 4.2cqw; opacity: 0.8; }
.sc-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.8cqw; }
.sc-brand { font-size: 7cqw; font-weight: 900; letter-spacing: 0.02em; color: var(--sc-accent); }
.sc-tag { font-size: 3.6cqw; opacity: 0.8; }
.sc-font-rounded { font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif; }
.sc-font-serif { font-family: "New York", ui-serif, Georgia, "Times New Roman", serif; }
.sc-font-serif .sc-title, .sc-font-serif .sc-brand { font-weight: 700; }
.sc-font-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.sc-font-mono .sc-title { font-size: 7cqw; }
.sc-font-condensed { font-family: "Arial Narrow", "Helvetica Neue", system-ui, sans-serif; font-stretch: condensed; }
.sc-font-condensed .sc-title, .sc-font-condensed .sc-brand { text-transform: uppercase; font-weight: 900; }

/* Place filter overlay: transparent PNG drawn above everything on the card. */
.sc-overlay { z-index: 3; background-position: center; background-size: cover; background-repeat: no-repeat; }

/* Reserved-band guide over the live preview, toggled by #f-band-guide in the preview pane. The app's
   card keeps its header in the top ≈ 8 % and its footer in the bottom ≈ 12 % (88–100 %). The dashes
   alternate black and white so they read on any background. */
.guide-toggle { margin-top: 0.75rem; font-size: 0.875rem; }
.preview-pane:has(#f-band-guide:checked) .sc::before,
.preview-pane:has(#f-band-guide:checked) .sc::after {
  position: absolute; left: 0; right: 0; z-index: 4; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  font: 700 3.2cqw/1.1 system-ui, -apple-system, sans-serif; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; text-shadow: 0 0 2px #000, 0 0 1px #000;
}
.preview-pane:has(#f-band-guide:checked) .sc::before {
  content: "Header · 0–8 %"; top: 0; height: 8%;
  background: repeating-linear-gradient(90deg, #fff 0 5px, #111 5px 10px) left bottom / 100% 2px no-repeat, rgba(0, 0, 0, 0.22);
}
.preview-pane:has(#f-band-guide:checked) .sc::after {
  content: "Footer · 88–100 %"; bottom: 0; height: 12%;
  background: repeating-linear-gradient(90deg, #fff 0 5px, #111 5px 10px) left top / 100% 2px no-repeat, rgba(0, 0, 0, 0.22);
}

/* Place filters */
.place-chip {
  display: inline-flex; gap: 0.3rem; align-items: center; margin: 0 0 0.75rem 0.5rem; padding: 0.2rem 0.7rem;
  border: 1px solid var(--fg); border-radius: 999px; font-size: 0.875rem; font-weight: 600;
}
.checker, .current-image img.checker {
  background: repeating-conic-gradient(#d9d9d9 0 25%, #ffffff 0 50%) 0 0 / 12px 12px;
}
.map-tools { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.map-search { display: flex; gap: 0.4rem; flex: 1 1 280px; }
.map-search input { min-height: 36px; }
.search-results { list-style: none; margin: 0 0 0.5rem; padding: 0; border: 1px solid var(--line); border-radius: 8px; max-height: 220px; overflow: auto; }
.search-results li { display: flex; gap: 0.4rem; align-items: center; padding: 0.4rem 0.6rem; border-top: 1px solid var(--line); font-size: 0.875rem; }
.search-results li:first-child { border-top: 0; }
.search-results .search-name { flex: 1; min-width: 0; }
.geofence-map { height: 440px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; z-index: 0; }
.geofence-map.is-testing { cursor: crosshair; }
.geofence-map.map-unavailable { display: flex; align-items: center; justify-content: center; height: auto; min-height: 120px; padding: 1rem; color: var(--muted); text-align: center; }
.geofence-map .leaflet-container, .geofence-map.leaflet-container { font: inherit; font-size: 0.8rem; }
.map-status { margin: 0.5rem 0 0; color: var(--muted); }
.map-status.is-error { color: var(--fg); font-weight: 600; }
.map-status.is-error::before { content: "⚠︎ "; }
.geofence-json { margin-top: 0.75rem; }
.geofence-json summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.5rem; }
@media (max-width: 600px) { .geofence-map { height: 340px; } }

/* Filter requests */
.filter-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 1rem; }
.filter-tabs a { text-decoration: none; padding: 0.3rem 0.75rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.875rem; color: var(--muted); }
.filter-tabs a[aria-current="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.filter-tabs .count { font-variant-numeric: tabular-nums; opacity: 0.75; }
