/* 멍 골목 · 관리 — a control desk beside the street: the night's dark, the lamp's amber for what's chosen, the street's
   pixel face for the headings, a plain Korean face for everything read and typed. One look, whatever the viewer's theme. */
#admin {
  --a-ground: #0a0d16;
  --a-raise: #131827;
  --a-raise-hi: #1c2236;
  --a-line: rgba(244, 228, 196, 0.12);
  --a-line-hi: rgba(244, 228, 196, 0.26);
  --a-ink: #f4e4c4;
  --a-dim: rgba(244, 228, 196, 0.64);
  --a-lamp: #ffb35c;
  --a-lamp-ink: #1a1208;
  --a-on: #7ad99a;
  --a-house: #8fb7ff;
  --a-red: #ff8a7a;
  --a-display: "DotGothic16", ui-monospace, monospace;
  --a-text: "Nanum Gothic", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --a-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  color-scheme: dark;
  position: fixed;
  z-index: 20;
  left: 0;
  top: 0;
  bottom: 0;
  width: clamp(360px, 36vw, 470px);
  display: flex;
  flex-direction: column;
  background: var(--a-ground);
  border-right: 1px solid var(--a-line);
  color: var(--a-ink);
  font: 14px/1.55 var(--a-text);
  -webkit-user-select: text;
  user-select: text;
  touch-action: auto;
}
#admin[hidden] { display: none; }
#admin *,
#admin *::before,
#admin *::after { box-sizing: border-box; }
#admin :focus-visible { outline: 2px solid var(--a-lamp); outline-offset: 2px; }

body.admin-open #ui,
body.admin-open #adsheet { display: none; }
body.admin-open,
body.admin-open.still { cursor: auto; }

/* ---------- the top: name, where saving goes, close ---------- */
.a-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: max(14px, env(safe-area-inset-top, 0px)) 16px 10px;
}
.a-title { flex: 1; min-width: 0; }
.a-head h1 {
  margin: 0;
  font: 22px/1.1 var(--a-display);
  letter-spacing: 0.08em;
  color: var(--a-lamp);
}
.a-head p { margin: 3px 0 0; font-size: 12px; color: var(--a-dim); }
.a-head .a-fold { display: none; }
#admin:focus { outline: none; }

.a-tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px;
  border-bottom: 1px solid var(--a-line);
}
.a-tabs button {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--a-dim);
  font: 16px/1 var(--a-display);
  letter-spacing: 0.06em;
  padding: 10px 10px 9px;
  cursor: pointer;
}
.a-tabs button:hover { color: var(--a-ink); }
.a-tabs button[aria-selected="true"] { color: var(--a-ink); border-bottom-color: var(--a-lamp); }

.a-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.a-body > * { flex-shrink: 0; }

/* ---------- the pieces everything is made of ---------- */
.a-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--a-line-hi);
  border-radius: 3px;
  background: var(--a-raise);
  color: var(--a-ink);
  font: 700 13px/1 var(--a-text);
  white-space: nowrap;
  cursor: pointer;
}
.a-btn:hover:not(:disabled) { background: var(--a-raise-hi); }
.a-btn:disabled { opacity: 0.42; cursor: default; }
.a-primary { background: var(--a-lamp); border-color: var(--a-lamp); color: var(--a-lamp-ink); }
.a-primary:hover:not(:disabled) { background: #ffc583; }
.a-danger { color: var(--a-red); border-color: rgba(255, 138, 122, 0.4); }
.a-icon-btn {
  appearance: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--a-line);
  border-radius: 3px;
  background: transparent;
  color: var(--a-dim);
  font: 15px/1 var(--a-text);
  cursor: pointer;
}
.a-icon-btn:hover:not(:disabled) { color: var(--a-ink); border-color: var(--a-line-hi); }
.a-icon-btn:disabled { opacity: 0.3; cursor: default; }
.a-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 2px 4px;
  color: var(--a-lamp);
  font: 12px/1.4 var(--a-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.a-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.a-h {
  margin: 0;
  font: 15px/1.2 var(--a-display);
  letter-spacing: 0.08em;
  color: var(--a-lamp);
}
.a-hint { margin: 0; font-size: 12px; line-height: 1.6; color: var(--a-dim); }
.a-hint code,
.a-ed-top code {
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--a-raise);
  color: var(--a-ink);
  font: 12px/1.4 var(--a-mono);
}
.a-warn { margin: 0; font-size: 12.5px; color: var(--a-lamp); }
.a-warn-inline { color: var(--a-lamp); }
.a-empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--a-line-hi);
  border-radius: 4px;
  color: var(--a-dim);
  font-size: 13px;
}
.a-confirm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 138, 122, 0.45);
  border-radius: 4px;
  background: rgba(255, 138, 122, 0.06);
}
.a-confirm p { margin: 0; font-size: 13px; }

/* text fields */
.a-body input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]),
.a-body textarea,
.a-body select {
  min-width: 0;
  max-width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--a-line-hi);
  border-radius: 3px;
  background: var(--a-raise);
  color: var(--a-ink);
  font: 14px/1.4 var(--a-text);
}
.a-body textarea { resize: vertical; }
.a-body input[type="number"] { width: 92px; font-variant-numeric: tabular-nums; }
.a-body input[type="time"],
.a-body input[type="date"] { font-variant-numeric: tabular-nums; }
.a-body input::placeholder,
.a-body textarea::placeholder { color: rgba(244, 228, 196, 0.35); }
.a-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.a-field > span:first-child { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; color: var(--a-dim); }
.a-inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.a-inline > span:first-child { flex: 1 1 170px; }
.a-check {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 13.5px;
  cursor: pointer;
}
.a-check input { flex: none; align-self: center; width: 16px; height: 16px; margin: 0; accent-color: var(--a-lamp); }
.a-check small { color: var(--a-dim); font-size: 12px; }
.a-seg {
  align-self: flex-start;
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  border: 1px solid var(--a-line-hi);
  border-radius: 3px;
  overflow: hidden;
}
.a-seg label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-right: 1px solid var(--a-line);
  font-size: 13px;
  cursor: pointer;
}
.a-seg label:last-child { border-right: 0; }
.a-seg label:has(input:checked) { background: var(--a-raise-hi); color: var(--a-lamp); }
.a-seg input { margin: 0; accent-color: var(--a-lamp); }

/* ---------- the list ---------- */
.a-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.a-bar p { margin: 0; font-size: 13px; color: var(--a-dim); }
.a-ads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.a-ad { display: flex; align-items: stretch; gap: 6px; }
.a-ad-main {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--a-line);
  border-radius: 4px;
  background: var(--a-raise);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.a-ad-main:hover { border-color: var(--a-line-hi); }
.a-thumb {
  grid-row: 1 / span 2;
  width: 112px;
  height: 56px;
  border-radius: 2px;
  image-rendering: pixelated;
}
.a-ad-text { min-width: 0; display: flex; flex-direction: column; }
.a-ad-text b { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.a-ad-text span { font-size: 12px; color: var(--a-dim); }
.a-state {
  justify-self: start;
  margin-top: 4px;
  padding: 1px 8px;
  border: 1px solid var(--a-line-hi);
  border-radius: 99px;
  color: var(--a-dim);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.a-state.is-on { color: var(--a-on); border-color: rgba(122, 217, 154, 0.5); }
.a-state.is-house { color: var(--a-house); border-color: rgba(143, 183, 255, 0.5); }
.a-ad.is-off .a-thumb { opacity: 0.45; filter: grayscale(1); }
.a-order { display: flex; flex-direction: column; justify-content: center; gap: 4px; }

/* ---------- the editor ---------- */
.a-ed { display: flex; flex-direction: column; gap: 18px; }
.a-ed-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.a-look {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--a-line);
  border-radius: 4px;
  background: #05070d;
}
.a-thumbs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.a-thumbs figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.a-thumbs canvas {
  width: calc(var(--w) * 2);
  height: calc(var(--h) * 2);
  max-width: 100%;
  image-rendering: pixelated;
}
.a-thumbs figcaption { font-size: 11px; color: var(--a-dim); }
.a-thumbs figcaption span { font-variant-numeric: tabular-nums; opacity: 0.75; }
.a-try { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--a-dim); }
.a-try > span:first-child { margin-right: 2px; }
.a-chip {
  appearance: none;
  padding: 4px 11px;
  border: 1px solid var(--a-line-hi);
  border-radius: 99px;
  background: transparent;
  color: var(--a-ink);
  font: 12px/1.3 var(--a-text);
  cursor: pointer;
}
.a-chip[aria-pressed="true"] { background: var(--a-lamp); border-color: var(--a-lamp); color: var(--a-lamp-ink); }
.a-try .a-btn { min-height: 28px; font-size: 12px; }
.a-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--a-line);
}
.a-icons { display: flex; flex-wrap: wrap; gap: 6px; }
.a-icon {
  appearance: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--a-line-hi);
  border-radius: 3px;
  background: var(--a-raise);
  color: var(--a-dim);
  font: 11px/1 var(--a-text);
  cursor: pointer;
}
.a-icon canvas { width: 26px; height: 26px; image-rendering: pixelated; }
.a-icon[aria-pressed="true"] { border-color: var(--a-lamp); box-shadow: 0 0 0 1px var(--a-lamp); color: var(--a-ink); }
.a-colors { display: flex; flex-wrap: wrap; gap: 14px; }
.a-colors label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.a-colors input[type="color"] {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--a-line-hi);
  border-radius: 3px;
  background: none;
  cursor: pointer;
}
.a-swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.a-swatch {
  appearance: none;
  width: 34px;
  height: 26px;
  border: 1px solid var(--a-line-hi);
  border-radius: 3px;
  font: 800 13px/1 "Nanum Gothic", sans-serif;
  cursor: pointer;
}
.a-pics { display: flex; flex-direction: column; gap: 12px; }
.a-pic { display: flex; align-items: flex-start; gap: 12px; }
.a-pic canvas {
  flex: none;
  border: 1px solid var(--a-line);
  background: repeating-conic-gradient(#1a1f2e 0 25%, #10131d 0 50%) 0 0 / 8px 8px;
  image-rendering: pixelated;
}
.a-pic canvas.wide { width: 112px; height: 56px; }
.a-pic canvas.tall { width: 60px; height: 60px; }
.a-pic b { display: block; font-size: 13px; }
.a-pic span { display: block; margin-bottom: 6px; font-size: 12px; color: var(--a-dim); }
.a-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.a-btns label.a-btn:has(+ .a-file:focus-visible) { outline: 2px solid var(--a-lamp); outline-offset: 2px; }
.a-ranges { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.a-range,
.a-hourly,
.a-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.a-hourly input[type="text"] { width: 96px; }
.a-hourly input[type="number"] { width: 72px; }
.a-days { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.a-day {
  appearance: none;
  width: 34px;
  height: 32px;
  border: 1px solid var(--a-line-hi);
  border-radius: 3px;
  background: transparent;
  color: var(--a-dim);
  font: 700 13px/1 var(--a-text);
  cursor: pointer;
}
.a-day[aria-pressed="true"] { background: var(--a-lamp); border-color: var(--a-lamp); color: var(--a-lamp-ink); }
.a-quick { display: inline-flex; gap: 2px; margin-left: 6px; }
.a-all { font-weight: 700; }
.a-places { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 8px; }
.a-place {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--a-line);
  border-radius: 3px;
  background: var(--a-raise);
}
.a-place-name { font-weight: 700; }
.a-slots { display: flex; flex-direction: column; gap: 5px; padding-left: 24px; }
.a-slots .a-check { font-size: 13px; }
.a-slots .a-check small { flex-basis: 100%; margin-top: -3px; padding-left: 24px; }
.a-ed-foot { padding-top: 12px; border-top: 1px solid var(--a-line); }
.a-ed-foot .a-primary { margin-left: auto; min-width: 88px; }

/* ---------- the day's schedule ---------- */
.a-day-pick { display: flex; align-items: center; gap: 10px; }
.a-day-pick b { font: 16px/1 var(--a-display); letter-spacing: 0.05em; }
.a-plan { display: flex; flex-direction: column; gap: 4px; }
.a-hours,
.a-prow { display: grid; grid-template-columns: minmax(84px, 32%) minmax(0, 1fr); gap: 10px; align-items: center; }
.a-hours > div { position: relative; height: 16px; font: 11px/16px var(--a-display); color: var(--a-dim); }
.a-hours > div span { position: absolute; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.a-hours > div span:first-child { transform: none; }
.a-hours > div span:last-child { transform: translateX(-100%); }
.a-pname {
  appearance: none;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--a-ink);
  font: 13px/1.3 var(--a-text);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.a-pname small { color: var(--a-dim); font-size: 11px; }
.a-track {
  position: relative;
  height: 22px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--a-line) 0 1px, transparent 1px 12.5%), var(--a-raise);
  overflow: hidden;
}
.a-track i { position: absolute; top: 4px; bottom: 4px; min-width: 2px; border-radius: 2px; background: var(--a-lamp); }
.a-track i.is-house { background: rgba(143, 183, 255, 0.38); }
.a-prow.is-off .a-track i { background: var(--a-line-hi); }
.a-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--a-on); }
.a-scroll { overflow-x: auto; }
.a-stats { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.a-stats th {
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--a-line-hi);
  color: var(--a-dim);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
.a-stats td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--a-line); }
.a-stats th + th,
.a-stats td + td { text-align: right; }

/* ---------- the settings ---------- */
.a-sec { display: flex; flex-direction: column; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--a-line); }
.a-sec:last-child { padding-bottom: 0; border-bottom: 0; }
.a-note { margin: 0; font-size: 13px; line-height: 1.65; }
.a-copybox { width: 100%; min-height: 140px; font: 12px/1.4 var(--a-mono) !important; }
.a-reset { display: flex; }

/* ---------- the bottom: what happened, and saving ---------- */
.a-msg { margin: 0; padding: 8px 16px; border-top: 1px solid var(--a-line); font-size: 13px; }
.a-msg.is-ok { color: var(--a-on); }
.a-msg.is-err { color: var(--a-red); }
.a-save {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--a-line);
  background: var(--a-ground);
}
.a-save p { margin: 0; font-size: 13px; color: var(--a-dim); }
.a-save.is-dirty p { color: var(--a-lamp); }

/* ---------- a narrow screen: the street above, the desk below ---------- */
@media (max-width: 759px) {
  #admin {
    top: auto;
    right: 0;
    width: auto;
    height: 62%;
    border-right: 0;
    border-top: 1px solid var(--a-line-hi);
  }
  #admin.is-folded { height: auto; }
  #admin.is-folded .a-tabs,
  #admin.is-folded .a-body,
  #admin.is-folded .a-msg { display: none; }
  .a-head { padding-top: 10px; }
  .a-head .a-fold { display: inline-flex; }
  .a-thumb { width: 84px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  #admin * { transition: none !important; }
}
