/* BarCrawler design language v2 — "night out, not admin panel" (spec D27)
   Palette: near-black violet base, neon pink primary, amber highlights.
   Hierarchy: one pink CTA per view; secondary = quiet; ghost = text. */
:root {
  --bg: #0e0d13; --panel: #17161e; --panel2: #211f2a; --border: #2f2c3c;
  --text: #f2f0f7; --muted: #9b97ac;
  --accent: #ff5c7a; --accent-soft: rgba(255, 92, 122, 0.14);
  --amber: #ffb454; --amber-soft: rgba(255, 180, 84, 0.14);
  --green: #3ddc97; --green-soft: rgba(61, 220, 151, 0.13);
  --red: #ff6b6b;
  font-size: 15px;
}
* { box-sizing: border-box; }
html { scrollbar-color: var(--panel2) var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
  -webkit-font-smoothing: antialiased; }

/* ---- chrome ---- */
#topbar { display: flex; align-items: center; gap: 18px; padding: 12px 18px;
  border-bottom: 1px solid var(--border); background: rgba(14, 13, 19, 0.92);
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(8px); }
#brand { font-weight: 800; letter-spacing: 0.2px; font-size: 17px; }
#brand::after { content: "."; color: var(--accent); }
#nav { display: flex; gap: 4px; flex: 1; }
#nav a { color: var(--muted); text-decoration: none; font-size: 13.5px;
  padding: 6px 12px; border-radius: 999px; transition: color 0.15s, background 0.15s; }
#nav a:hover { color: var(--text); }
#nav a.active { color: var(--text); background: var(--panel2); }
#whoami { color: var(--muted); font-size: 13px; white-space: nowrap; }
#whoami a { color: var(--muted); }
#langbtn { border-radius: 999px; }
main { max-width: 960px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---- type & surfaces ---- */
h2 { font-size: 17px; font-weight: 700; margin: 6px 0 12px; letter-spacing: 0.1px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; margin-bottom: 14px; }
.card.composer { border-color: var(--accent); background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--panel); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.grow { flex: 1; } .mt { margin-top: 12px; } .center { text-align: center; }

/* ---- controls ---- */
input, select, button { background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
  font-size: 14px; font-family: inherit; transition: border-color 0.15s, background 0.15s, transform 0.06s; }
input::placeholder { color: #6e6a80; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
button { cursor: pointer; }
button:hover { border-color: #423e54; }
button:active { transform: scale(0.97); }
button.primary { background: var(--accent); border-color: var(--accent); color: #1a0710; font-weight: 700; }
button.primary:hover { background: #ff7390; border-color: #ff7390; }
button.danger { color: var(--red); background: transparent; border-color: transparent; }
button.danger:hover { border-color: var(--red); }
button:disabled { opacity: 0.45; cursor: default; }

/* ---- pills & status ---- */
.pill { font-size: 12px; padding: 3px 11px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted); }
.pill.good { background: var(--green-soft); border-color: transparent; color: var(--green); }
.pill.warm { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.pill.hot  { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.status { font-size: 12px; padding: 3px 11px; border-radius: 999px; cursor: pointer;
  user-select: none; border: 1px solid transparent; font-weight: 600; }
.status.todo  { background: var(--panel2); color: var(--muted); }
.status.doing { background: var(--amber-soft); color: var(--amber); }
.status.done  { background: var(--green-soft); color: var(--green); }
.status:hover { border-color: currentColor; }

/* ---- lists & rows ---- */
.list-item { display: flex; gap: 10px; align-items: center; padding: 10px 6px;
  border-bottom: 1px solid var(--border); border-radius: 6px; transition: background 0.12s; }
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: rgba(255, 255, 255, 0.02); }
.event-link { display: block; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 14px; margin-bottom: 10px; color: var(--text); text-decoration: none;
  background: var(--panel); transition: border-color 0.15s, transform 0.12s; }
.event-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 800;
  color: #14131a; flex-shrink: 0; }

/* ---- highlight strips ---- */
.mayor-strip { display: flex; gap: 8px; align-items: center; margin-top: 10px;
  padding: 8px 12px; border-radius: 10px; background: var(--amber-soft);
  color: var(--amber); font-size: 13px; }

/* ---- tabs / segmented ---- */
.tabs { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.tabs button { border-radius: 999px; padding: 7px 16px; background: transparent; color: var(--muted); }
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #1a0710; font-weight: 700; }

/* ---- board ---- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.board .col { background: var(--panel2); border-radius: 12px; padding: 10px; min-height: 120px; }
.board .col h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px; }
.tcard { background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; margin-bottom: 8px; font-size: 14px; }

/* ---- map ---- */
#map { height: 60vh; min-height: 380px; border-radius: 14px; border: 1px solid var(--border); }
#minimap { border: 1px solid var(--border); }
.leaflet-container { background: #0b0a10; }
.dark-tiles { filter: brightness(0.7) invert(1) contrast(1.05) hue-rotate(200deg) saturate(0.4) brightness(0.9); }
.member-dot { border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.35); display: flex; align-items: center;
  justify-content: center; font-size: 10px; font-weight: 800; color: #14131a; }
.stop-marker { background: #0f6e56; color: #e1f5ee; border-radius: 50%;
  border: 2px solid #e1f5ee; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; }

/* ---- stop editor ---- */
.stop-row { display: grid; grid-template-columns: 24px 1fr 90px 150px 150px 32px; gap: 6px;
  align-items: center; margin-bottom: 6px; }
.stop-row .seq { color: var(--muted); text-align: center; }

/* ---- money ---- */
.balance-pos { color: var(--green); }
.balance-neg { color: var(--red); }

/* ---- toast ---- */
#toast { position: fixed; bottom: -80px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 11px 20px; font-size: 14px; z-index: 200;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55); transition: bottom 0.25s ease;
  max-width: 84vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toast.show { bottom: 22px; }

/* ---- tip chips ---- */
.chiprow { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border-radius: 999px; padding: 6px 14px; background: var(--panel2);
  border: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---- map clusters + zone overlays (build7 item 6) ---- */
.cluster { border-radius: 50%; background: rgba(255, 92, 122, 0.88); color: #1a0710;
  font-weight: 800; font-size: 13px; text-align: center; border: 2px solid #ffd9e2;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); cursor: pointer; }
.zone-label { text-align: center; font-size: 11px; font-weight: 700; color: #d9d5ea;
  text-shadow: 0 1px 4px #000, 0 0 10px #000; letter-spacing: 0.4px; cursor: pointer; }

/* ---- drill-down map: heat overview + side panel ---- */
.heat-label { display: flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; font-size: 12px; color: #fff;
  text-shadow: 0 1px 4px #000, 0 0 12px #000; white-space: nowrap; }
.heat-label .heat-n { border-radius: 999px; padding: 1px 8px; font-size: 11px;
  font-weight: 800; color: #1a0710; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.dirwrap { position: relative; display: flex; gap: 10px; align-items: stretch; margin-bottom: 4px; }
#mapcol { position: relative; flex: 1; min-width: 0; }
#barsmap { height: 380px; border-radius: 14px; border: 1px solid var(--border); }
.mapback { position: absolute; top: 10px; left: 10px; z-index: 500; border-radius: 999px;
  background: rgba(23, 22, 30, 0.92); backdrop-filter: blur(4px); font-size: 13px; }
.dirpanel { width: 290px; flex-shrink: 0; max-height: 380px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
@media (max-width: 820px) {
  .dirwrap { display: block; }
  .dirpanel { width: auto; max-height: 42vh; margin-top: 8px; }
  .dirwrap.haspanel #barsmap { height: 260px; }
}

/* ---- swipe deck (build7 item 7) ---- */
.deck { position: relative; height: 380px; touch-action: pan-y; }
.deck-card { position: absolute; inset: 0; border-radius: 18px; border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel2), var(--panel)); padding: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; user-select: none; cursor: grab; will-change: transform; }
.deck-card.dragging { transition: none; cursor: grabbing; }
.deck-card:not(.dragging) { transition: transform 0.28s ease, opacity 0.28s ease; }
.deck-card .photo { width: 120px; height: 120px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 40px; font-weight: 800;
  color: #14131a; margin-bottom: 12px; background-size: cover; background-position: center; }
.deck-verdict { position: absolute; top: 18px; font-size: 26px; font-weight: 900;
  letter-spacing: 2px; padding: 4px 16px; border-radius: 10px; border: 3px solid;
  opacity: 0; transform: rotate(-12deg); pointer-events: none; }
.deck-verdict.like { left: 18px; color: var(--green); border-color: var(--green); }
.deck-verdict.pass { right: 18px; color: var(--red); border-color: var(--red); transform: rotate(12deg); }

/* ---- chat (build7 item 7) ---- */
.chatlog { max-height: 46vh; overflow-y: auto; padding: 4px 2px; }
.bubble { display: inline-block; max-width: 78%; padding: 8px 13px; border-radius: 14px;
  background: var(--panel2); border: 1px solid var(--border); font-size: 14px;
  word-break: break-word; text-align: left; }
.msg-row { margin: 6px 0; display: flex; flex-direction: column; align-items: flex-start; }
.msg-row.mine { align-items: flex-end; }
.msg-row.mine .bubble { background: var(--accent); border-color: var(--accent); color: #1a0710; }
.msg-meta { font-size: 10.5px; color: var(--muted); margin: 2px 6px; }
.bubble .tr { display: block; margin-top: 5px; padding-top: 5px; border-top: 1px dashed rgba(155,151,172,.4);
  font-size: 13px; opacity: 0.92; }

a { color: var(--accent); }
.legend { position: relative; }
@media (max-width: 700px) {
  .stop-row { grid-template-columns: 20px 1fr 70px 32px; }
  .stop-row .when { display: none; }
  .board { grid-template-columns: 1fr; }
  #nav a { padding: 6px 9px; font-size: 13px; }
}
