/* BuildScore (ระบบตัวอย่าง) — โทเคนดีไซน์และคอมโพเนนต์ร่วม
   สีและระยะห่างถอดมาจากอาร์ตบอร์ดบนแคนวาสโดยตรง (ต้นฉบับ Credit/public/assets/app.css)
   ฟอนต์ Prompt ฝังในโฟลเดอร์ assets/fonts (OFL) ไม่ดึงจาก CDN เพื่อไม่ให้มีการเรียกออกนอกเว็บ */

@font-face { font-family: "Prompt"; src: url("../fonts/prompt-light.woff") format("woff"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Prompt"; src: url("../fonts/prompt-regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Prompt"; src: url("../fonts/prompt-medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Prompt"; src: url("../fonts/prompt-semibold.woff") format("woff"); font-weight: 600 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-header: #11141b;
  --bg-card: #161a23;
  --bg-sunken: #0d1017;
  --bg-row: #12151c;
  --bg-chip: #1c212c;
  --line: #262c39;
  --line-strong: #333b4d;
  --text: #e6eaf2;
  --muted: #8d97ab;
  --dim: #5b6478;
  --teal: #5eead4;
  --sky: #38bdf8;
  --amber: #fbbf24;
  --amber-soft: #fde68a;
  --amber-dim: #d9c89a;
  --orange: #fb923c;
  --rose: #fb7185;
  --rose-dim: #d99aa4;
  --ink: #05231f;
  --r-sm: 8px; --r: 11px; --r-md: 12px; --r-lg: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Prompt", Thonburi, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: break-word;
}
b, strong { font-weight: 600; }

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--sky); }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul { padding-left: 18px; }
svg { display: block; }

.page { max-width: 1440px; margin: 0 auto; }
.pad { padding-left: 40px; padding-right: 40px; }

/* ---------- แถบระบบตัวอย่าง (แบบเดียวกับเดโม่ booking) ---------- */
.topwrap { position: sticky; top: 0; z-index: 20; }
.demo-bar { background: #fde047; color: #1c1917; font-size: 12.5px; }
.demo-bar__in { max-width: 1440px; margin: 0 auto; padding: 6px 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.demo-bar__note { display: flex; align-items: center; gap: 8px; flex: 1 1 300px; min-width: 0; }
.demo-bar__badge { background: #1c1917; color: #fde047; font-weight: 600; border-radius: 999px; padding: 1px 10px; white-space: nowrap; }
.demo-bar__links { display: flex; gap: 14px; align-items: center; }
.demo-bar__links button { color: #1c1917; background: none; border: 0; padding: 0; cursor: pointer; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }
.demo-bar__short { display: none; }
.fict { display: inline-block; margin-left: 2px; padding: 0 6px; border-radius: 6px; font-size: 0.78em; font-weight: 500; line-height: 1.5; vertical-align: 0.08em; color: #fde68a; background: rgba(253,224,71,0.1); border: 1px solid rgba(253,224,71,0.28); white-space: nowrap; }
.disclaimer { margin: 24px 40px 40px; }

/* ---------- ส่วนหัว ---------- */
.hdr {
  display: flex; align-items: center; gap: 20px; min-height: 64px;
  padding: 0 40px; border-bottom: 1px solid var(--line); background: var(--bg-header);
}
.hdr-search { flex: 1 1 180px; max-width: 320px; min-width: 0; height: 40px; padding: 0 14px; }
.hdr-user { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--teal), var(--sky)); color: var(--ink);
}
.nav { display: flex; gap: 2px; font-size: 14px; margin-left: 12px; flex-shrink: 0; }
.nav a { white-space: nowrap; }
.nav a { padding: 8px 12px; border-radius: var(--r-sm); color: var(--muted); }
.nav a:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav a.on { color: var(--text); background: var(--bg-chip); }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; flex-shrink: 0; white-space: nowrap; }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px;
  background: var(--bg-chip); border: 1px solid var(--line-strong); font-size: 13px; font-weight: 600;
}
.bell {
  position: relative; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 10px; background: var(--bg-chip); border: 1px solid var(--line-strong); cursor: pointer;
}
.bell .dot {
  position: absolute; top: -4px; right: -4px; display: grid; place-items: center;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--rose); color: #2a0710; font-size: 10px; font-weight: 700;
}

/* ---------- องค์ประกอบพื้นฐาน ---------- */
.card { border: 1px solid var(--line); background: var(--bg-card); border-radius: var(--r-lg); }
.card-pad { padding: 20px; }
.kicker { font-size: 11.5px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--dim); }
.lbl { font-size: 11.5px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--bg-chip); color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: #232936; }
.btn-primary {
  border: 0; background: linear-gradient(135deg, var(--teal), var(--sky));
  color: var(--ink); font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: 999px; font-size: 11.5px;
}
.pill-teal { background: rgba(94,234,212,0.12); color: var(--teal); border: 1px solid rgba(94,234,212,0.3); }
.pill-sky { background: rgba(56,189,248,0.12); color: var(--sky); border: 1px solid rgba(56,189,248,0.3); }
.pill-amber { background: rgba(251,191,36,0.12); color: var(--amber); border: 1px solid rgba(251,191,36,0.3); }
.pill-rose { background: rgba(251,113,133,0.12); color: var(--rose); border: 1px solid rgba(251,113,133,0.3); }
.pill-plain { background: var(--bg-card); color: var(--muted); border: 1px solid var(--line); }

.input, .select, .textarea {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border: 1px solid var(--line-strong); background: var(--bg-sunken);
  border-radius: var(--r); font-size: 14px; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: rgba(94,234,212,0.5); }
.textarea { align-items: flex-start; min-height: 74px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12.5px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th.h {
  padding: 11px 18px; font-size: 11.5px; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--muted); font-weight: 500; text-align: left; background: var(--bg-chip);
}
td.cell, th.cell { padding: 11px 16px; font-size: 13px; vertical-align: top; }
tbody tr { border-top: 1px solid var(--line); }
tbody tr:nth-child(even) { background: var(--bg-row); }

.bar { height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; }

.note {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px;
  border: 1px solid var(--line-strong); background: var(--bg-header); border-radius: var(--r-lg);
  font-size: 12.5px; line-height: 1.75; color: var(--muted);
}
.note strong { color: var(--text); font-weight: 600; }
.note-amber { border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.05); color: var(--amber-dim); }
.note-amber strong { color: var(--amber-soft); }
.note-rose { border-color: rgba(251,113,133,0.32); background: rgba(251,113,133,0.05); color: var(--rose-dim); }
.note-rose strong { color: var(--rose); }

.score-badge {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: var(--r-md);
  border: 1px solid rgba(94,234,212,0.35); background: rgba(94,234,212,0.1);
}
.score-badge b { font-size: 17px; font-weight: 700; line-height: 1; }
.score-badge span { font-size: 9px; }
.c-teal { color: var(--teal); } .c-sky { color: var(--sky); }
.c-amber { color: var(--amber); } .c-rose { color: var(--rose); }
.b-teal { border-color: rgba(94,234,212,0.35); background: rgba(94,234,212,0.1); }
.b-sky { border-color: rgba(56,189,248,0.35); background: rgba(56,189,248,0.1); }
.b-amber { border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.1); }
.b-rose { border-color: rgba(251,113,133,0.35); background: rgba(251,113,133,0.1); }

/* ---------- ป๊อปอัป / แจ้งเตือน ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.62); display: grid; place-items: center;
  z-index: 60; padding: 24px;
}
.modal {
  width: min(560px, 100%); max-height: 86vh; overflow: auto;
  background: var(--bg-card); border: 1px solid var(--line-strong); border-radius: 16px; padding: 24px;
}
.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast {
  padding: 13px 16px; border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--bg-card); font-size: 13px; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}
.toast.ok { border-color: rgba(94,234,212,0.4); }
.toast.err { border-color: rgba(251,113,133,0.45); }

.skeleton { color: var(--dim); font-size: 13px; padding: 24px 0; }
.hidden { display: none !important; }

.panel-drop {
  position: absolute; right: 40px; top: 60px; width: 380px; z-index: 40;
  background: var(--bg-card); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: 0 18px 44px rgba(0,0,0,0.5); overflow: hidden;
}

/* ตารางกว้าง: เลื่อนซ้าย-ขวาในกรอบของตัวเองบนจอแคบ (หน้าเว็บไม่ล้นจอ) */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll > table { min-width: 560px; }

@media (max-width: 1280px) {
  .hdr { flex-wrap: wrap; row-gap: 0; padding-top: 10px; }
  .hdr .nav { order: 3; flex: 1 1 100%; margin-left: -12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .hdr .nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 1100px) {
  .pad { padding-left: 20px; padding-right: 20px; }
  .hdr { padding: 10px 20px 0; }
  .demo-bar__in { padding: 6px 20px; }
  .disclaimer { margin: 24px 20px 32px; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .topwrap { position: static; }
  .hdr { gap: 12px; }
  .hdr-user { display: none; }
  .hdr-search { order: 4; flex: 1 1 100%; max-width: none; margin-bottom: 10px; }
  .hdr .nav { margin-left: -8px; flex-wrap: wrap; overflow: visible; row-gap: 2px; }
  .nav a { padding: 6px 10px; }
  .demo-bar__long { display: none; }
  .demo-bar__short { display: inline; }
  .demo-bar__in { padding: 6px 16px; }
  .pad { padding-left: 16px; padding-right: 16px; }
  .disclaimer { margin: 20px 16px 28px; }
  td.cell, th.cell { padding: 10px 10px; }
  th.h { padding: 10px 10px; }
  .table-scroll > table { min-width: 0 !important; }
  /* ตารางหลายคอลัมน์ → การ์ดทีละแถวบนมือถือ */
  .stack-sm thead { display: none; }
  .stack-sm, .stack-sm tbody { display: block; }
  .stack-sm tr { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 12px; padding: 12px 14px; }
  .stack-sm td.cell { display: block; padding: 0 !important; width: auto !important; text-align: left !important; }
  .stack-sm td.full, .stack-sm td[colspan] { grid-column: 1 / -1; }
  .stack-sm td.end { text-align: right !important; }
  .stack-sm td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--dim); }
  .modal-bg { padding: 12px; }
  .modal { padding: 18px; }
  .toast-wrap { left: 12px; right: 12px; }
  .toast { max-width: none; }
  .panel-drop { right: 12px; left: 12px; width: auto; }
}
@media print { .demo-bar { display: none; } .topwrap { position: static; } }
