/* ═══════════════════════════════════════════════════════════════════════════
   แท็กแบบ SevenRooms (0074) — ชิป · จุดสีบนโต๊ะ · หน้าเลือกแท็ก · บล็อกแท็กในแผงใบจอง
   ═══════════════════════════════════════════════════════════════════════════
   สีของหมวดมาจากร้าน (tag_cat.colour) ผ่าน --tc ที่ applyWidths() ตั้งด้วย CSSOM (CSP บล็อก style=)
   ทุกสีบนจอผสมจาก --tc กับสีของธีม — ตัวหนังสือผสมกับ --ink จึงอ่านได้ทั้งพื้นมืดและพื้นสว่าง
   ไม่ว่าร้านจะตั้งสีอ่อนหรือเข้มแค่ไหน · ไม่มี --tc (คำเก่าไม่มีหมวด) = สีกลางของธีม
   ห้าม letter-spacing กับข้อความในไฟล์นี้ — ชื่อคำเป็นไทยได้เสมอ */

.tagchip {
  --tc: var(--ink-mute);
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 26px; padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--tc) 48%, transparent);
  background: color-mix(in srgb, var(--tc) 14%, transparent);
  color: color-mix(in srgb, var(--tc) 62%, var(--ink));
  font-size: 13px; font-weight: 500; line-height: 1.35;
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.tagchip--sm { min-height: 22px; padding: 1px 8px; font-size: 12px; }
/* ติดโปรไฟล์ = ขึ้นทุกครั้งที่ลูกค้ามา · จุดเล็ก ๆ หน้าคำบอกว่า "เป็นเรื่องของคน ไม่ใช่ของคืนนี้" */
.tagchip--prof::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; flex: none;
  background: currentColor; opacity: .75;
}
/* อ่อนไหว (อาหาร · สุขภาพ) — เส้นหนาขึ้น เป็นสิ่งแรกที่ตาจับได้บนแถวที่แน่น */
.tagchip--care { border-width: 1.5px; font-weight: 600; }

.tagrow { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }

/* จุดสีของหมวด — หัวหมวดในหน้าเลือก · มุมการ์ดโต๊ะบนผัง */
.tagdot {
  --tc: var(--ink-mute);
  display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--tc);
}
.tagdots { display: inline-flex; gap: 2px; align-items: center; }
.tagdots .tagdot { width: 8px; height: 8px; box-shadow: 0 0 0 1.5px var(--surface); }
.tagdots .tagdot--care { width: 10px; height: 10px; }

/* ───────── บล็อกแท็กในแผงใบจอง / โปรไฟล์ ───────── */
.tagblock-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tagblock-h h3 { margin: 0; }
.tagblock .tagrow { margin-top: 8px; }
/* แผงใบจอง — บล็อกแท็กอยู่ระหว่างโน้ตกับการ์ดจำนวนคน ต้องมีระยะก่อนการ์ดถัดไป */
.tagblock.mt-2 { margin-bottom: 14px; }
.tagblock .tagchip { font-size: 14px; min-height: 30px; padding: 3px 12px; }
.tagnote { display: block; margin-top: 6px; font-size: 12.5px; color: var(--ink-mute); }

/* ───────── หน้าเลือกแท็ก ───────── */
.tp { display: grid; gap: 4px; }
.tp-search {
  position: sticky; top: 0; z-index: 2;
  /* ปิดช่องว่างเหนือช่องค้นหา (padding ของแผ่น) — ไม่งั้นชิปที่เลื่อนผ่านโผล่ขึ้นมาให้เห็นเหนือช่อง */
  box-shadow: 0 -16px 0 var(--surface);
  display: flex; align-items: center; gap: 8px;
  min-height: var(--tap); padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink-mute);
}
.tp-search:focus-within { border-color: var(--bronze); }
.tp-search input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 16px; padding: 10px 0; min-height: 44px;
}
.tp-search input:focus { outline: none; }
.tp-body { display: grid; gap: 2px; padding-bottom: 8px; }
.tp-cat { display: grid; gap: 8px; padding: 14px 0 6px; border-bottom: 1px solid var(--line-soft); }
.tp-cat:last-child { border-bottom: 0; }
.tp-cat-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14.5px; font-weight: 600; flex-wrap: wrap; }
.tp-cat-name { min-width: 0; }
.tp-where {
  font-size: 11.5px; font-weight: 500; color: var(--ink-mute);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 8px;
}
.tp-n { margin-left: auto; color: var(--ink-mute); font-weight: 500; font-variant-numeric: tabular-nums; }
.tp-note { margin: -2px 0 0; font-size: 12.5px; color: var(--ink-mute); }
.tp-note--care { color: var(--danger-text); }
.tp-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.tagchip--pick {
  min-height: var(--tap); padding: 6px 14px; font-size: 14.5px;
  cursor: pointer; white-space: normal; text-align: left;
}
.tagchip--pick[aria-pressed="true"] {
  border: 2px solid var(--tc);
  background: color-mix(in srgb, var(--tc) 30%, var(--surface));
  color: var(--ink); font-weight: 600;
}
.tagchip--pick[aria-pressed="true"]::after { content: "✓"; font-size: 13px; }
.tagchip--pick:disabled { opacity: .38; cursor: not-allowed; }
.tagchip--pick:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }

.tp-ask { display: grid; gap: 10px; padding: 16px 0; }
.tp-ask b { font-size: 17px; }
.tp-ask p { margin: 0; color: var(--ink-dim); font-size: 14px; }
.tp-ask-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }

.tp-foot {
  position: sticky; bottom: 0; z-index: 2;
  display: grid; grid-template-columns: 1fr 2fr; gap: 8px;
  padding: 10px 0 calc(4px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: 1px solid var(--line);
}

/* ───────── รายการจอง · Pre-Shift · Clients ───────── */
.rsv-tags .tagchip { font-size: 12.5px; }
.ps-marks .tagchip { font-size: 12.5px; min-height: 22px; }

/* ปุ่ม "แก้แท็ก" — เป้าเต็มสูง แต่ไม่กินทั้งแถว (หัวบล็อกมีชื่อหัวข้ออยู่ซ้าย) */
.tagblock-edit { flex: none; width: auto; padding: 8px 14px; font-size: 14px; }
.tagblock .label-like { font-size: 12px; color: var(--ink-dim); }

/* ───────── ผังโต๊ะ ───────── */
/* โต๊ะบนผัง — จุดเกาะมุมขวาบนนอกกรอบ ไม่เบียดชื่อแขกในโต๊ะเล็ก · การ์ด/ราง — อยู่ในแถวหัวการ์ด */
.tbl > .tagdots { position: absolute; top: -5px; right: -5px; pointer-events: none; z-index: 1; }
.t-top .tagdots, .rail-name .tagdots { margin-left: 4px; }

/* ───────── Clients ───────── */
/* แถวประวัติเป็น flex แถวเดียว — แท็กของใบขึ้นบรรทัดใหม่เต็มความกว้าง ไม่เบียดวันที่/สถานะ */
.cl-bk { flex-wrap: wrap; }
.cl-bk-tags { flex-basis: 100%; }
.cl-tags .tagchip { margin: 0 4px 4px 0; }
.tagblock .tagnote .tagchip { margin-right: 6px; vertical-align: middle; }
.cl-bytag { display: grid; gap: 8px; }
.cl-bytag-l { font-size: 12px; color: var(--ink-dim); }
.cl-bytag select {
  min-height: var(--tap); padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-size: 15px;
}

/* ───────── หน้าตั้งค่า Tags ───────── */
.tg-cat .adm-item-head { cursor: pointer; }
.tg-cat-dot { width: 12px; height: 12px; }
.tg-chev { color: var(--ink-mute); font-size: 18px; width: 18px; text-align: center; }
.tg-cat.is-off .adm-item-txt b, .tg-tag.is-off .tagchip { opacity: .55; }
/* ปุ่มของหมวด/คำ — กว้างตามคำ ไม่ใช่เต็มแถว (สามปุ่มเต็มแถวต่อคำ × 41 คำ = หน้ายาวเกินอ่าน) */
.tg-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-acts .btn { width: auto; flex: 0 0 auto; padding: 8px 16px; }
/* minmax(0,1fr) — ตัวแก้ของคำมีแถวปุ่มเลือกหมวดยาว ๆ แทร็กอัตโนมัติจะยืดตามมันจนกล่องล้นขอบขวา (วัดบนจอ 390) */
.tg-tags { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 12px; }
.tg-edit .adm-chips { flex-wrap: wrap; }
.tg-edit .adm-input { min-width: 0; max-width: 100%; }
.tg-tag {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--tap);
  padding: 6px 2px; border: 0; border-top: 1px solid var(--line-soft); background: transparent;
  color: var(--ink); font: inherit; text-align: start; cursor: pointer;
}
.tg-tag small { flex: 1; min-width: 0; color: var(--ink-mute); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-tags .tg-edit { margin: 8px 0; }
.tg-del-btn { color: var(--danger-text); }
.tg-del { display: grid; gap: 8px; margin-bottom: 10px; }
.tg-del p { margin: 0; font-size: 13.5px; color: var(--ink-dim); }
.tg-colours .tg-colour { min-width: var(--tap); justify-content: center; }
.tg-colours .tg-colour .tagdot { width: 16px; height: 16px; }
.tg-edit .adm-field { margin-bottom: 12px; }

/* จองผ่าน (0082 · แผ่น Booked By แบบ SevenRooms) — ใช้โครงเดียวกับบล็อกแท็ก */
.chanblock .chanval { display: block; margin-top: 6px; font-size: 15px; font-weight: 600; }
.chanblock .chips { margin-top: 8px; }
