/* โทเค็นสีและตัวอักษรที่หน้าบ้าน/หลังบ้านใช้ร่วมกัน — สีหลักมาจากแบรนด์ Maison (กรมท่า + ทอง) */
:root {
  --paper: #F1F2F4;
  --surface: #FFFFFF;
  --ink: #1E2640;        /* กรมท่า Maison */
  --ink-2: #4B5368;
  --ink-3: #7E8496;
  --line: #DADDE3;
  --brand: #1E2640;
  --brand-hover: #131930;
  --gold: #A88A5C;
  --plan-bg: #ECE8E0;    /* สีพื้นของรูปผัง ให้ขอบรูปกลืนกับพื้นที่แผนที่ */
  --danger: #B23A30;
  --focus: #2F6FD0;

  --font-display: 'Bai Jamjuree', 'IBM Plex Sans Thai Looped', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Thai Looped', 'Bai Jamjuree', system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --shadow-float: 0 1px 2px rgba(30, 38, 64, .08), 0 8px 24px rgba(30, 38, 64, .16);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* โลโก้ Maison Development (สีทองพื้นใส) มุมซ้ายบน */
.brand-logo { display: block; flex: none; line-height: 0; }
.brand-logo img { display: block; width: auto; height: 52px; }

/* ---------- สัญลักษณ์สถานะ: วงกลมสีเดียวกับหมุด ---------- */
.glyph {
  --c: var(--ink-3);
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c);
  /* เส้นขอบบางๆ ให้เห็นจุดได้แม้ตั้งสีหมุดอ่อนมาก */
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .18);
}

/* ---------- หมุดบนผัง ---------- */
.leaflet-container.plan-map { background: var(--plan-bg); font-family: var(--font-body); }
/* หมุดแบบ maison-core-system: วงกลมสีทึบ ขอบขาว เงา ตัวเลขขาวหนา */
.plan-map .unit-pin {
  cursor: pointer;
  filter: drop-shadow(0 4px 4px rgba(15, 23, 42, .25)) drop-shadow(0 2px 2px rgba(15, 23, 42, .2));
}
.plan-map .unit-pin.is-updated { animation: pin-flash 1.1s ease-in-out 2; }
@keyframes pin-flash {
  50% { stroke: #1E2640; stroke-width: 8px; }
}
/* เลขแปลงในหมุด: กล่อง 0×0 ตรงจุดกึ่งกลาง แล้วจัดข้อความให้อยู่กลางด้วย transform */
.leaflet-tooltip.pin-label {
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  pointer-events: none;
}
.leaflet-tooltip.pin-label::before { display: none; }
.pin-code {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(var(--pin-font, 12px) * min(1, calc(3.4 / var(--len, 3))));
  line-height: 1;
  color: #fff;
  /* เงาบางๆ ให้เลขสีขาวอ่านออกบนหมุดสีเหลือง (จอง) */
  text-shadow: 0 0 1px rgba(15, 23, 42, .55), 0 1px 1px rgba(15, 23, 42, .35);
  white-space: nowrap;
}
.pin-code.is-dark { color: #1e2640; text-shadow: none; }
.pin-labels-hidden .leaflet-tooltip.pin-label { display: none; }
.leaflet-tooltip.unit-tip { font-family: var(--font-body); font-size: 13px; }

/* คำอธิบายสีหมุด */
.pin-key {
  position: absolute;
  z-index: 450;
  top: 12px;
  left: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  max-width: calc(100% - 80px);
  margin: 0;
  padding: 8px 14px;
  list-style: none;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 1px 4px rgba(30, 38, 64, .18);
  font-size: 13px;
}
.pin-key li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink-3); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn--danger { color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); }
.btn--small { min-height: 34px; padding: 4px 12px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: progress; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
