/* ============ สีและค่าพื้นฐาน ============ */
:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #eef0f9;
  --text: #141a33;
  --muted: #5b6482;
  --border: #e1e4f0;
  --primary: #4338ca;
  --primary-2: #7c3aed;
  --primary-ink: #ffffff;
  --primary-soft: #eceafe;
  --gold: #ffb020;
  --gold-ink: #2a1a00;
  --ok: #0f8a5f;
  --ok-soft: #dcf5ea;
  --warn: #9a5b00;
  --warn-soft: #fff0d4;
  --bad: #c2261c;
  --bad-soft: #fde4e1;
  --hero: linear-gradient(135deg, #0b0f3a 0%, #1d1f73 48%, #4c1d95 100%);
  --grad: linear-gradient(135deg, var(--primary), var(--primary-2));
  --shadow-sm: 0 1px 2px rgba(20,26,51,.06);
  --shadow: 0 2px 4px rgba(20,26,51,.04), 0 10px 30px -8px rgba(40,38,120,.16);
  --shadow-lg: 0 20px 50px -12px rgba(40,38,120,.35);
  --r1: #4f5bff; --r2: #0fb39a; --r3: #ff7a45; --r4: #b556ff;
  --r5: #e0287a; --r6: #0a8fd1; --r7: #5c9a0e; --r8: #64748b; --r9: #c2410c; --r10: #0f766e;
  --radius: 18px;
  /* การ์ดสี: สัดส่วนสีห้องที่ต้นและปลายสีไล่ และสีที่ผสมที่ปลาย */
  --tint-from: 92%; --tint-to: 58%; --tint-mix: #ffe6f7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0c1d; --surface: #121532; --surface-2: #1a1e42; --text: #eaedfb; --muted: #9ea6c9;
    --border: #272d5c; --primary: #8b93ff; --primary-2: #b98cff; --primary-ink: #0a0c1d; --primary-soft: #1f2356;
    --ok: #4fd6a0; --ok-soft: #0f2e25; --warn: #ffc15a; --warn-soft: #34270d; --bad: #ff8a80; --bad-soft: #3a1618;
    --shadow: 0 10px 30px -10px rgba(0,0,0,.6); --shadow-lg: 0 20px 50px -12px rgba(0,0,0,.7);
    --r1: #7c86ff; --r2: #3fd6bb; --r3: #ff9a6e; --r4: #cc85ff; --r5: #f472b6; --r6: #38bdf8; --r7: #a3d94a; --r8: #94a3b8; --r9: #fb923c; --r10: #2dd4bf;
    --tint-from: 100%; --tint-to: 55%; --tint-mix: #1a1050;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0c1d; --surface: #121532; --surface-2: #1a1e42; --text: #eaedfb; --muted: #9ea6c9;
  --border: #272d5c; --primary: #8b93ff; --primary-2: #b98cff; --primary-ink: #0a0c1d; --primary-soft: #1f2356;
  --ok: #4fd6a0; --ok-soft: #0f2e25; --warn: #ffc15a; --warn-soft: #34270d; --bad: #ff8a80; --bad-soft: #3a1618;
  --shadow: 0 10px 30px -10px rgba(0,0,0,.6); --shadow-lg: 0 20px 50px -12px rgba(0,0,0,.7);
  --r1: #7c86ff; --r2: #3fd6bb; --r3: #ff9a6e; --r4: #cc85ff; --r5: #f472b6; --r6: #38bdf8; --r7: #a3d94a; --r8: #94a3b8; --r9: #fb923c; --r10: #2dd4bf;
  --tint-from: 100%; --tint-to: 55%; --tint-mix: #1a1050;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Sarabun", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.65;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--primary) 9%, transparent) 1px, transparent 0);
  background-size: 26px 26px;
}
h1, h2, h3, h4, legend, .section-title, .btn, nav.tabs a, .stat b, .brand-name { font-family: "Prompt", "Sarabun", sans-serif; }
a { color: var(--primary); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
svg.i { width: 1em; height: 1em; flex: none; }

/* ============ ส่วนหัว ============ */
/* แสงสีทองมุมขวาเป็นพื้นหลัง (ไม่ใช้ overflow: hidden เพื่อให้เมนูผู้ใช้เลื่อนลงมาเกินส่วนหัวได้) */
header.top {
  color: #fff; position: relative; z-index: 30;
  background: radial-gradient(circle at calc(100% - 150px) -40px, rgba(255,176,32,.28), transparent 260px), var(--hero);
}
header.top .wrap { display: flex; align-items: center; gap: 14px; padding-top: 16px; padding-bottom: 16px; position: relative; }
.logo {
  width: 64px; height: 64px; border-radius: 50%; flex: none; display: block; overflow: hidden;
  background: #fff; padding: 2px;
  box-shadow: 0 0 0 3px rgba(255,201,77,.55), 0 10px 26px -8px rgba(0,0,0,.5);
  transition: transform .25s;
}
a.logo:hover { transform: rotate(-6deg) scale(1.05); }
.logo img { width: 100%; height: 100%; display: block; border-radius: 50%; }
header.top h1 { font-size: 1.2rem; margin: 0; line-height: 1.3; font-weight: 600; letter-spacing: .1px; }
header.top p { margin: 2px 0 0; color: rgba(255,255,255,.72); font-size: .9rem; }
.theme-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; font: inherit; font-size: .88rem;
  transition: background .2s, transform .15s;
}
.theme-btn:hover { background: rgba(255,255,255,.2); }
.theme-btn:active { transform: scale(.94); }
.lang-btn + .theme-btn { margin-left: 0; }
.lang-btn { font-weight: 700; letter-spacing: .5px; }
/* ไอคอนพระอาทิตย์ (โหมดสว่าง) / พระจันทร์ (โหมดมืด) หมุนสลับกัน */
.theme-ico { display: inline-grid; }
.theme-ico svg { grid-area: 1 / 1; transition: transform .6s cubic-bezier(.34,1.56,.64,1), opacity .35s; }
.theme-ico .moon { opacity: 0; transform: rotate(-120deg) scale(.3); }
:root[data-theme="dark"] .theme-ico .sun { opacity: 0; transform: rotate(120deg) scale(.3); }
:root[data-theme="dark"] .theme-ico .moon { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-ico .sun { opacity: 0; transform: rotate(120deg) scale(.3); }
  :root:not([data-theme="light"]) .theme-ico .moon { opacity: 1; transform: none; }
}
/* การเปลี่ยนโหมดแบบวงกลม: ปิดภาพจางของเบราว์เซอร์ ให้ JS คุมการขยายวงกลมเอง */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

nav.tabs {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
nav.tabs .wrap { display: flex; gap: 6px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; scrollbar-width: none; }
nav.tabs .wrap::-webkit-scrollbar { display: none; }
nav.tabs a {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  color: var(--muted); padding: 8px 16px; border-radius: 999px; text-decoration: none; font-weight: 500; font-size: .95rem;
  transition: color .2s, background .2s;
}
nav.tabs a:hover { color: var(--primary); background: var(--primary-soft); }
nav.tabs a[aria-current="page"] { color: #fff; background: var(--grad); box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--primary) 70%, transparent); }
:root[data-theme="dark"] nav.tabs a[aria-current="page"] { color: #fff; }

main { padding: 32px 0 64px; }
h2 { font-size: 1.5rem; margin: 0 0 4px; font-weight: 600; line-height: 1.35; }
.lead { color: var(--muted); margin: 0 0 22px; }

/* หัวข้อของแต่ละหน้า */
.page-head { margin-bottom: 24px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; letter-spacing: .3px;
  color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 3px 12px; margin-bottom: 10px;
}
.page-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}

/* ============ หน้าหลัก ============ */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; color: #fff;
  background: var(--hero); box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: 24px;
  padding: clamp(28px, 5vw, 56px);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(10px); pointer-events: none;
}
.hero::before { width: 380px; height: 380px; right: -80px; top: -120px; background: radial-gradient(circle, rgba(255,176,32,.35), transparent 65%); }
.hero::after { width: 420px; height: 420px; left: -140px; bottom: -220px; background: radial-gradient(circle, rgba(124,58,237,.55), transparent 65%); }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { background: rgba(255,255,255,.12); color: #ffd98a; }
.hero h2 { font-size: clamp(1.9rem, 4.4vw, 3rem); line-height: 1.2; font-weight: 700; margin-bottom: 14px; }
.hero h2 .hl {
  background: linear-gradient(90deg, #ffd166, #ff8a4c); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: rgba(255,255,255,.8); font-size: 1.05rem; margin: 0 0 26px; max-width: 520px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art svg { width: 100%; height: auto; max-height: 340px; display: block; filter: drop-shadow(0 20px 40px rgba(0,0,0,.35)); }
.beam { animation: beam 5s ease-in-out infinite alternate; transform-origin: top center; transform-box: fill-box; }
.beam.b2 { animation-delay: -2.5s; }
@keyframes beam { from { transform: rotate(-6deg); opacity: .55; } to { transform: rotate(6deg); opacity: .95; } }
.eq rect { animation: eq 1.2s ease-in-out infinite alternate; transform-origin: bottom; transform-box: fill-box; }
.eq rect:nth-child(2) { animation-delay: -.3s; } .eq rect:nth-child(3) { animation-delay: -.6s; }
.eq rect:nth-child(4) { animation-delay: -.9s; } .eq rect:nth-child(5) { animation-delay: -.45s; }
.eq rect:nth-child(6) { animation-delay: -.75s; } .eq rect:nth-child(7) { animation-delay: -.15s; }
@keyframes eq { from { transform: scaleY(.3); } to { transform: scaleY(1); } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: -36px 24px 40px; position: relative; z-index: 2; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; display: flex; gap: 14px; align-items: center;
}
.stat .ico {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none;
  font-size: 22px; color: #fff; background: var(--c, var(--grad));
}
.stat b { display: block; font-size: 1.75rem; line-height: 1.1; font-weight: 700; }
.stat span { color: var(--muted); font-size: .86rem; line-height: 1.35; display: block; }

.section { margin-bottom: 44px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head .lead { margin: 0; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: s; }
.steps li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 20px; position: relative; overflow: hidden;
}
.steps li::after {
  counter-increment: s; content: counter(s); position: absolute; right: 10px; top: -14px;
  font: 700 5rem/1 "Prompt", sans-serif; color: var(--primary); opacity: .07;
}
.steps .ico {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px;
  background: var(--primary-soft); color: var(--primary); margin-bottom: 12px;
}
.steps b { display: block; font-family: "Prompt", sans-serif; font-weight: 600; margin-bottom: 2px; }
.steps span { color: var(--muted); font-size: .92rem; }

.rooms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.room {
  display: flex; flex-direction: column; padding: 0; overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}
.room:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.room-top {
  position: relative; height: 118px; color: #fff; padding: 16px; display: flex; align-items: flex-start; justify-content: space-between;
  background:
    radial-gradient(circle at 85% 20%, rgba(255,255,255,.35), transparent 40%),
    linear-gradient(135deg, color-mix(in srgb, var(--rc) var(--tint-from), #fff), color-mix(in srgb, var(--rc) var(--tint-to), var(--tint-mix)));
}
.room-top .room-ico {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px;
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3); backdrop-filter: blur(4px);
}
.room-top .room-no { font: 700 3.4rem/1 "Prompt", sans-serif; opacity: .35; }
.room .body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.room h3 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.room .cap { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: 6px; }
.room .cap b { color: var(--text); font-family: "Prompt", sans-serif; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 2px 10px; font-size: .8rem; color: var(--muted); }
.room .today { font-size: .86rem; margin-top: auto; }
.room .btn { width: 100%; }

/* ============ แบบฟอร์ม ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.full { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.step {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin-bottom: 18px;
}
legend, .section-title {
  font-weight: 600; font-size: 1.12rem; margin-bottom: 14px; padding: 0;
  display: flex; align-items: center; gap: 10px;
}
fieldset.step legend { float: left; width: 100%; }
fieldset.step legend + * { clear: both; }
.step-no {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--grad); color: #fff; font-size: .95rem; box-shadow: 0 6px 16px -6px var(--primary);
}
label.f { display: block; font-weight: 500; margin-bottom: 6px; font-size: .93rem; }
.req { color: var(--bad); }
input[type=text], input[type=tel], input[type=email], input[type=url], input[type=date], input[type=time],
input[type=number], input[type=password], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1.5px solid transparent; border-radius: 12px; padding: 10px 14px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
input:hover, select:hover, textarea:hover { border-color: var(--border); }
input:focus, select:focus, textarea:focus {
  outline: none; background: var(--surface); border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
textarea { min-height: 96px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.divider { display: none; }

.room-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.room-pick label {
  border: 1.5px solid var(--border); border-radius: 14px; padding: 14px; cursor: pointer; position: relative;
  display: flex; flex-direction: column; gap: 2px; background: var(--surface); transition: all .2s;
}
.room-pick label:hover { border-color: var(--rc); transform: translateY(-2px); }
.room-pick .rp-ico {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; margin-bottom: 6px;
  color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--rc) var(--tint-from), #fff), color-mix(in srgb, var(--rc) var(--tint-to), var(--tint-mix)));
}
.room-pick input { position: absolute; opacity: 0; pointer-events: none; }
.room-pick label:has(input:checked) {
  border-color: var(--rc); background: color-mix(in srgb, var(--rc) 10%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rc) 25%, transparent);
}
.room-pick label:has(input:checked)::after {
  content: "✓"; position: absolute; top: 10px; right: 12px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--rc); color: #fff; font-size: .8rem; display: grid; place-items: center; font-weight: 700;
}
.room-pick label:has(input:focus-visible) { outline: 2px solid var(--primary); }
.room-pick small { color: var(--muted); }

.svc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.svc label {
  display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--border);
  border-radius: 14px; padding: 12px 14px; cursor: pointer; background: var(--surface); position: relative; transition: all .2s;
}
.svc label:hover { border-color: var(--primary); }
.svc .s-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none;
  background: var(--primary-soft); color: var(--primary); transition: all .2s;
}
.svc input[name=svc] { position: absolute; opacity: 0; pointer-events: none; }
.svc label:has(input[name=svc]:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--surface)); }
.svc label:has(input[name=svc]:checked) .s-ico { background: var(--grad); color: #fff; }
.svc label:has(input[name=svc]:checked)::after {
  content: "✓"; position: absolute; top: 8px; right: 10px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: var(--primary-ink); font-size: .75rem; display: grid; place-items: center; font-weight: 700;
}
.svc label:has(input[name=svc]:focus-visible) { outline: 2px solid var(--primary); }
.svc small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.qty { display: none; margin-top: 6px; }
.svc label:has(input[name=svc]:checked) .qty { display: block; }
.qty input { padding: 4px 8px; width: 80px; }

.detail-guide {
  margin-top: 4px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); font-size: .92rem;
}
.detail-guide ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.detail-guide li { display: flex; align-items: center; gap: 8px; }
.detail-guide li svg { color: var(--primary); font-size: 1.05rem; }
.disclaimer {
  margin-top: 14px; padding: 12px 16px; border-radius: 12px; font-size: .92rem; line-height: 1.6;
  background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  transition: opacity .2s;
}
.disclaimer.muted { opacity: .55; }
.disclaimer .ack, .setup-note .ack { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--text); font-weight: 500; cursor: pointer; }
.disclaimer .ack input, .setup-note .ack input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.disclaimer.muted .ack { cursor: default; }
.history { margin-top: 10px; font-size: .88rem; }
.history summary { cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.history summary:hover { color: var(--primary); }
.history ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.history ul { margin: 2px 0 0; padding-left: 16px; }
.history s { color: var(--muted); }
.edit-banner { margin-bottom: 18px; border-left: 5px solid var(--gold); }
.edit-banner input { max-width: 320px; }
.job-note.changed { background: var(--warn-soft); color: var(--warn); }
.req-detail { margin-top: 8px; font-size: .9rem; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.link-group { margin-top: 16px; }
.link-group > .f { display: flex; align-items: center; gap: 6px; }
.link-group > .f svg { color: var(--primary); }
.link-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; }
.link-group .note { margin: 6px 0 0; }
.drive-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; }
.drive-link:hover { text-decoration: underline; }
.no-detail { color: var(--warn); font-weight: 500; }

.notice { border-radius: 12px; padding: 12px 16px; font-size: .95rem; margin-top: 14px; display: none; border: 1px solid transparent; }
.notice.show { display: block; animation: pop .25s ease; }
.notice.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.form-actions {
  position: sticky; bottom: 12px; z-index: 5; margin-top: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 16px; padding: 12px; box-shadow: var(--shadow-lg);
}
.form-actions .actions { margin-top: 0; }

/* ============ ปุ่ม ============ */
.btn {
  font: inherit; font-family: "Prompt", sans-serif; font-weight: 500; border-radius: 12px; padding: 10px 20px; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; text-decoration: none;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -8px var(--primary); }
.btn.primary:hover { color: #fff; box-shadow: 0 12px 26px -8px var(--primary); transform: translateY(-1px); }
.btn.gold { background: linear-gradient(135deg, #ffc94d, #ff8a4c); border-color: transparent; color: var(--gold-ink); font-weight: 600; box-shadow: 0 10px 30px -8px rgba(255,140,60,.7); }
.btn.gold:hover { color: var(--gold-ink); transform: translateY(-2px); }
.btn.ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.3); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.16); color: #fff; border-color: #fff; }
.btn.lg { padding: 13px 26px; font-size: 1.05rem; border-radius: 14px; }
.btn.sm { padding: 5px 12px; font-size: .86rem; border-radius: 10px; }
.btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.btn.ok:hover { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.bad:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }

/* ============ ตารางการใช้ห้อง ============ */
.sched-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.sched-bar input { width: auto; }
.sched-date { font: 600 1.05rem "Prompt", sans-serif; margin-left: auto; }
.timeline { overflow-x: auto; }
.tl { min-width: 780px; display: grid; grid-template-columns: 150px 1fr; }
.tl .hours { display: grid; grid-template-columns: repeat(11, 1fr); font-size: .78rem; color: var(--muted); }
.tl .hours span { padding: 4px 0 8px 6px; border-left: 1px dashed var(--border); }
.tl .rname { padding: 10px 12px 10px 0; font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: 10px; }
.tl .rname .r-ico {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; color: #fff; flex: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--rc) var(--tint-from), #fff), color-mix(in srgb, var(--rc) var(--tint-to), var(--tint-mix)));
}
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tl .lane {
  position: relative; min-height: 64px; margin: 5px 0; border-radius: 12px; background-color: var(--surface-2);
  background-image: repeating-linear-gradient(to right, color-mix(in srgb, var(--muted) 18%, transparent) 0 1px, transparent 1px calc(100% / 11));
}
.now-line { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--bad); border-radius: 2px; z-index: 2; }
.now-line::before { content: ""; position: absolute; top: -4px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.blk {
  position: absolute; top: 6px; bottom: 6px; border-radius: 10px; padding: 4px 10px;
  font-size: .8rem; line-height: 1.35; overflow: hidden; color: #fff; cursor: default;
  background-image: linear-gradient(135deg, rgba(255,255,255,.22), transparent 60%);
  box-shadow: 0 6px 14px -6px rgba(0,0,0,.4); transition: transform .15s;
}
.blk:hover { transform: translateY(-2px); z-index: 3; }
.blk.pending { opacity: .7; background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.2) 0 6px, transparent 6px 12px); }
.legend { display: flex; gap: 18px; font-size: .86rem; color: var(--muted); margin-top: 16px; flex-wrap: wrap; }

/* ============ รายการคำขอ ============ */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; box-shadow: var(--shadow-sm);
}
.filters select, .filters input { width: auto; }
.search { position: relative; flex: 1; min-width: 240px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; }
.search input { width: 100%; padding-left: 42px; }
.req-list { display: grid; gap: 14px; }
.req-item {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; position: relative; overflow: hidden; padding-left: 26px;
  transition: box-shadow .2s, transform .2s;
}
.req-item:hover { box-shadow: var(--shadow-lg); }
.req-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--rc, var(--primary)); }
.req-item h4 { margin: 0 0 4px; font-size: 1.08rem; font-weight: 600; }
.req-meta { color: var(--muted); font-size: .9rem; }
.req-svcs { margin-top: 8px; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 12px; font-size: .8rem; font-weight: 600; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.approved { background: var(--ok-soft); color: var(--ok); }
.badge.rejected { background: var(--bad-soft); color: var(--bad); }
.req-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.req-actions .btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty .big { font-size: 2.6rem; display: block; margin-bottom: 6px; color: var(--primary); opacity: .6; }
.admin-gate { max-width: 440px; margin: 12px auto 0; text-align: center; padding: 32px; }
.admin-gate .lock {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 30px;
  background: var(--grad); color: #fff; box-shadow: 0 12px 26px -10px var(--primary);
}
.admin-gate input { text-align: center; letter-spacing: 6px; font-size: 1.2rem; }
.admin-gate .actions { justify-content: center !important; }
.admin-gate .btn { width: 100%; }
.note { font-size: .88rem; color: var(--muted); }

/* ============ ทีมงานที่รับผิดชอบ ============ */
.staff-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: .9rem; }
.staff-line > svg { color: var(--primary); font-size: 1.1rem; }
.team-tag {
  display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; margin-left: 4px;
  color: #fff; background: var(--tc, var(--primary));
}
.team-tag.extra { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border); }

.dlg {
  width: min(760px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border);
  border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dlg::backdrop { background: rgba(10, 12, 40, .55); backdrop-filter: blur(4px); }
.dlg[open] { animation: pop .2s ease; }
.dlg form { padding: 24px; }
.dlg-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.dlg-head h3 { margin: 0; font-size: 1.2rem; font-weight: 600; }
.dlg-head .note { margin: 2px 0 0; }
.dlg-head .step-no { width: 40px; height: 40px; font-size: 20px; }
.dlg-x {
  margin-left: auto; background: var(--surface-2); border: 0; color: var(--muted); width: 34px; height: 34px;
  border-radius: 50%; cursor: pointer; font-size: 1rem; flex: none;
}
.dlg-x:hover { color: var(--text); }

.teams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.team {
  border: 1.5px solid var(--border); border-radius: 16px; padding: 0 0 8px; overflow: hidden;
  background: var(--surface); transition: border-color .2s;
}
.team:has(input:checked) { border-color: var(--tc); }
.team-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; margin-bottom: 6px;
  background: color-mix(in srgb, var(--tc) 12%, var(--surface)); border-bottom: 1px solid var(--border);
}
.team-head b { font-family: "Prompt", sans-serif; font-weight: 600; color: var(--tc); }
.team-head small { margin-left: auto; color: var(--muted); font-size: .78rem; }
.team input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--tc); flex: none; margin: 0; }
.member { display: flex; gap: 10px; align-items: flex-start; padding: 6px 14px; cursor: pointer; font-size: .93rem; }
.member:hover { background: var(--surface-2); }
.member input { margin-top: 3px !important; }
.member small.busy { display: block; color: var(--warn); font-size: .76rem; line-height: 1.3; }

.extra-box { margin-top: 18px; }
.extra-row { display: flex; gap: 8px; }
.extra-row input { flex: 1; }
#extraList { margin-top: 8px; }
.chip.removable { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary); padding: 3px 6px 3px 12px; }
.chip.removable button {
  border: 0; background: none; color: inherit; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; font-size: .75rem;
}
.chip.removable button:hover { background: var(--primary); color: var(--primary-ink); }
.dlg-summary { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: .9rem; }

/* ============ ส่วนท้าย ============ */
footer { background: var(--hero); color: rgba(255,255,255,.75); font-size: .9rem; padding: 32px 0; }
footer .wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
footer b { color: #fff; font-family: "Prompt", sans-serif; font-weight: 500; }
footer .note { color: rgba(255,255,255,.55); }
footer .logo { width: 72px; height: 72px; }

/* ============ ภาพเคลื่อนไหวตอนเปิดหน้า ============ */
main .wrap > * { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
main .wrap > *:nth-child(2) { animation-delay: .08s; }
main .wrap > *:nth-child(3) { animation-delay: .16s; }
main .wrap > *:nth-child(4) { animation-delay: .24s; }
main .wrap > *:nth-child(5) { animation-delay: .32s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============ สรุปผลงาน (หน้าเจ้าหน้าที่) ============ */
.seg {
  display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.seg button {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer;
  font: 500 .95rem "Prompt", sans-serif; color: var(--muted); padding: 8px 16px; border-radius: 10px;
}
.seg button:hover { color: var(--primary); }
.seg button[aria-selected="true"] { background: var(--grad); color: #fff; }
.seg.sm { margin: 0; padding: 3px; border-radius: 11px; box-shadow: none; }
.seg.sm button { font-size: .82rem; padding: 4px 12px; border-radius: 8px; }
.name-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 8px; }
.date-field { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.kpi-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; font-size: 20px;
  background: var(--primary-soft); color: var(--primary);
}
.kpi-label { display: block; font-size: .84rem; color: var(--muted); line-height: 1.35; }
.kpi b { font: 700 1.7rem/1.2 "Prompt", sans-serif; }
.kpi-unit { font-size: .84rem; color: var(--muted); }

.report-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chart-head h3 { margin: 0; font-size: 1.08rem; font-weight: 600; }
.chart-head .note { margin: 2px 0 0; }

.hbars { display: grid; gap: 2px; }
.hbar-row {
  display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 12px; align-items: center;
  padding: 5px 6px; border-radius: 8px; outline: none; cursor: default;
}
.hbar-row:hover, .hbar-row:focus-visible { background: var(--surface-2); }
.hbar-row:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); }
.hb-label { min-width: 0; line-height: 1.25; }
.hb-name { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-sub { display: block; font-size: .76rem; color: var(--muted); }
.hb-track { display: flex; align-items: center; gap: 8px; height: 24px; border-left: 1px solid var(--border); }
.hb-bar { height: 18px; min-width: 0; border-radius: 0 4px 4px 0; background: linear-gradient(to right, var(--primary), var(--primary-2)); transition: width .4s ease; }
.hb-val { font-size: .86rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.hb-val.zero { color: var(--muted); font-weight: 400; }

/* ผู้ใช้ที่เข้าสู่ระบบ (มุมขวาบน) */
.user-box { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.logout-top { margin-left: 0; }
.user-box + .theme-btn { margin-left: 0; }
.user-menu { position: relative; }
.user-menu summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
  background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 7px 14px; font-size: .88rem;
}
.user-menu summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 260px; display: grid; gap: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow-lg);
}
.user-pop .note { margin: 0; word-break: break-all; }
.role-tag { justify-self: start; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 600; }

/* หน้าเข้าสู่ระบบ */
.auth-card { max-width: 560px; margin: 0 auto 18px; padding: 28px; text-align: center; }
.auth-card h3 { margin: 6px 0; }
.auth-steps { text-align: left; display: grid; gap: 4px; margin: 12px 0; }
.google-btn {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 22px; font-weight: 600;
  background: #fff; color: #1f1f1f; border: 1px solid #dadce0; border-radius: 999px;
}
.google-btn svg { width: 22px; height: 22px; }
.google-btn:hover { box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.qr { display: block; width: 220px; height: 220px; margin: 10px auto; background: #fff; border-radius: 12px; padding: 8px; }
.secret { font-size: .95rem; letter-spacing: 1px; word-break: break-all; }
.code-form { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.code-form input { width: 190px; text-align: center; font: 600 1.3rem "Prompt", monospace; letter-spacing: 4px; }
.backup-codes { list-style: none; padding: 0; margin: 14px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.backup-codes code { display: block; padding: 8px; border-radius: 10px; background: var(--surface-2); font-size: 1.05rem; letter-spacing: 1px; }

/* Passkey */
.passkey-btn { display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 22px; font-size: 1.02rem; }
.passkey-btn svg { width: 24px; height: 24px; }
.or-line { display: flex; align-items: center; gap: 12px; margin: 22px 0 6px; color: var(--muted); font-size: .88rem; }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.passkey-tip { margin: 0 0 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--primary-soft); color: var(--text); }

/* จัดการผู้ใช้ / บันทึกการใช้งาน */
.user-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.user-add { display: grid; grid-template-columns: 2fr 1.2fr 1.4fr 1.4fr auto; gap: 10px; align-items: end; }
.perm-matrix td, .perm-matrix th { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.status-off { color: var(--bad); font-weight: 600; }
.audit-detail { font-size: .8rem; color: var(--muted); word-break: break-all; }

/* ยืนยันเบอร์โทรก่อนดู/แก้ไขคำขอ */
.lookup { padding: 20px; margin-bottom: 18px; }
.verify-row { display: flex; gap: 10px; flex-wrap: wrap; }
.verify-row input { flex: 1; min-width: 200px; }

/* ผู้ขอจัดเตรียมสถานที่เอง */
.setup-note {
  margin-top: 16px; padding: 14px 16px; border-radius: 14px; font-size: .92rem; line-height: 1.6;
  background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.setup-note > b { display: block; color: var(--warn); margin-bottom: 2px; }
.setup-note .ack { margin-top: 10px; }

/* คะแนนผู้ขอใช้บริการ */
.rating-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: .9rem; }
.stars, .stars-avg { color: #f5a524; letter-spacing: 1px; }
.rating-note { color: var(--muted); font-style: italic; }
.star-pick { display: flex; justify-content: center; gap: 6px; }
.star-pick label { cursor: pointer; font-size: 2.6rem; line-height: 1; color: var(--border); transition: transform .15s, color .15s; }
.star-pick label:hover { transform: scale(1.15); }
.star-pick label.on { color: #f5a524; }
.star-pick input { position: absolute; opacity: 0; pointer-events: none; }
.star-pick label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.star-caption { text-align: center; color: var(--muted); margin: 6px 0 14px; font-weight: 600; }

/* แจ้งเตือนทาง LINE */
.line-box {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 0 0 18px; border-radius: 14px;
  background: color-mix(in srgb, #06c755 10%, var(--surface)); border: 1px solid color-mix(in srgb, #06c755 35%, transparent);
  color: var(--text);
}
.line-box > svg { font-size: 22px; color: #06c755; margin-top: 2px; }
.line-steps { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.line-code { font: 700 1.4rem "Prompt", monospace; letter-spacing: 3px; color: #06c755; }
.btn.line { background: #06c755; border-color: #06c755; color: #fff; }
.btn.line:hover { background: #05b04b; }

/* Dashboard สถานะงานปัจจุบัน */
.dash-now { margin-bottom: 26px; }
.dash-now .kpis { margin-bottom: 14px; }
.kpi.warn .kpi-ico { background: var(--warn-soft); color: var(--warn); }
.kpi.warn b { color: var(--warn); }
.warn-text { color: var(--warn); font-weight: 600; }
table.data tr.is-today td { background: color-mix(in srgb, var(--primary-soft) 60%, transparent); }
.section-sub { font-size: 1.1rem; font-weight: 600; margin: 0 0 12px; }

/* ภาพรวมผลงานทีมงานสื่อ: มาตรวัด และกราฟโดนัท ใช้สีหลักของระบบ เปลี่ยนตามโหมดสว่าง/มืด */
.overview {
  --ov-panel: var(--surface-2); --ov-line: var(--border); --ov-muted: var(--muted);
  --ov-track: color-mix(in srgb, var(--primary) 14%, transparent);
  background: radial-gradient(circle at 90% 0%, color-mix(in srgb, var(--primary-2) 14%, transparent), transparent 55%), var(--surface);
  color: var(--text); border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.ov-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ov-head h3 { margin: 0; font-size: 1.2rem; font-weight: 600; }
.ov-head p { margin: 2px 0 0; color: var(--ov-muted); font-size: .88rem; }
.ov-big { display: flex; gap: 10px; flex-wrap: wrap; }
/* การ์ดสีสดแบบเดียวกับหัวการ์ดห้อง (.room-top) */
.ov-big div, .gauge {
  color: #fff;
  background:
    radial-gradient(circle at 85% 15%, rgba(255,255,255,.35), transparent 45%),
    linear-gradient(135deg, color-mix(in srgb, var(--rc) var(--tint-from), #fff), color-mix(in srgb, var(--rc) var(--tint-to), var(--tint-mix)));
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--rc) 70%, transparent);
}
.ov-big div { border-radius: 14px; padding: 8px 16px; min-width: 110px; }
.ov-big div, .gauge { text-shadow: 0 1px 3px color-mix(in srgb, var(--rc) 55%, #000 45%); }
.g-lit { stroke: #fff; }
.ov-big b { display: block; font: 700 1.6rem/1.15 "Prompt", sans-serif; font-variant-numeric: tabular-nums; }
.ov-big span { font-size: .78rem; color: rgba(255,255,255,.85); }
.ov-gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.gauge { position: relative; border-radius: 18px; padding: 14px 14px 10px; outline: none; transition: transform .2s ease; }
.gauge:hover { transform: translateY(-3px); }
.gauge:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.gauge svg { display: block; width: 100%; height: auto; overflow: visible; }
.gauge svg path { stroke-linecap: butt; }
.g-track { stroke: rgba(255,255,255,.22); }
.g-lit { stroke: #fff; filter: drop-shadow(0 2px 6px rgba(0,0,0,.18)); }
.g-text { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; line-height: 1.1; }
.g-label { display: block; font-size: .9rem; font-weight: 600; color: #fff; margin-bottom: 6px; text-align: center; }
.g-text b { font: 700 clamp(1.4rem, 3.4vw, 2.1rem)/1 "Prompt", sans-serif; font-variant-numeric: tabular-nums; }
.g-unit { font-size: .85rem; color: rgba(255,255,255,.85); margin-left: 3px; }
.ov-donuts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ov-panel { background: var(--ov-panel); border: 1px solid var(--ov-line); border-radius: 18px; padding: 14px 16px; }
.ov-panel h4 { margin: 0 0 10px; font-size: .95rem; font-weight: 600; }
.donut-wrap { display: grid; grid-template-columns: minmax(120px, 170px) 1fr; gap: 16px; align-items: center; }
.donut { position: relative; }
.donut svg { display: block; width: 100%; height: auto; transform: rotate(0deg); }
.d-track { stroke: var(--ov-track); }
.donut circle[tabindex] { outline: none; cursor: default; transition: stroke-width .15s; }
.donut circle[tabindex]:hover, .donut circle[tabindex]:focus-visible { stroke-width: 8; }
.d-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; line-height: 1.1; }
.d-center b { font: 700 1.7rem "Prompt", sans-serif; }
.d-center span { font-size: .76rem; color: var(--ov-muted); }
.d-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: .86rem; }
.d-legend li { display: grid; grid-template-columns: 12px 1fr auto 38px; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--ov-line); }
.d-legend li.zero { opacity: .45; }
.d-legend .dot { width: 10px; height: 10px; border-radius: 3px; }
.d-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-legend b { font-variant-numeric: tabular-nums; }
.d-pct { color: var(--ov-muted); text-align: right; font-variant-numeric: tabular-nums; }
.ov-empty { color: var(--ov-muted); margin: 0; }

/* กราฟแท่งแนวตั้ง: ภาระงานตามช่วงเวลา */
.cols { display: flex; align-items: stretch; gap: 3px; height: 220px; padding-top: 6px; border-bottom: 1px solid var(--border); }
.col {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  position: relative; border-radius: 6px 6px 0 0; outline: none; padding-bottom: 22px;
}
.col:hover, .col:focus-visible { background: var(--surface-2); }
.col:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); }
.col-bar { width: min(100%, 34px); min-height: 0; border-radius: 4px 4px 0 0; background: linear-gradient(to top, var(--primary), var(--primary-2)); transition: height .4s ease; }
.col-val { font-size: .74rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3; }
.col-label {
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  font-size: .7rem; color: var(--muted); white-space: nowrap;
}

/* แท่งสถานะคำขอแบ่งสัดส่วน */
.stackbar { display: flex; gap: 3px; height: 30px; border-radius: 8px; overflow: hidden; margin: 6px 0 16px; }
.stackbar i { min-width: 6px; outline: none; }
.stackbar i:focus-visible { box-shadow: inset 0 0 0 2px var(--text); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.legend li { display: grid; grid-template-columns: 14px 1fr auto 44px; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.legend li.total { grid-template-columns: 1fr auto 44px; border-bottom: 0; font-weight: 600; padding-left: 28px; }
.legend b { font: 600 1.05rem "Prompt", sans-serif; font-variant-numeric: tabular-nums; text-align: right; }
.legend .note { margin: 0; text-align: right; }
.legend .dot { width: 12px; height: 12px; border-radius: 3px; }

.chart-tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 260px;
  background: var(--text); color: var(--bg); border-radius: 10px; padding: 8px 12px; font-size: .84rem; line-height: 1.45;
  box-shadow: var(--shadow-lg);
}

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: .84rem; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.grp td { background: var(--surface-2); font-weight: 600; }
table.data td.indent { padding-left: 28px; }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: 0; }

/* ============ งานของฉัน ============ */
.me-bar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 18px; }
.me-bar b { display: block; font: 600 1.1rem "Prompt", sans-serif; }
.me-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font: 700 1.3rem "Prompt", sans-serif; color: #fff; background: var(--tc, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc, var(--primary)) 25%, transparent);
}
.job-list { display: grid; gap: 14px; }
.job { display: grid; grid-template-columns: 84px 1fr; gap: 18px; padding: 18px; position: relative; overflow: hidden; }
.job::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--rc); }
.job-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  border-radius: 16px; padding: 10px 6px; align-self: start; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--rc) var(--tint-from), #fff), color-mix(in srgb, var(--rc) var(--tint-to), var(--tint-mix)));
}
.job-date b { font: 700 2rem/1.05 "Prompt", sans-serif; }
.jd-wd, .jd-m { font-size: .78rem; opacity: .9; }
.job-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.when { font: 600 .8rem "Prompt", sans-serif; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.when.today { background: var(--bad); color: #fff; }
.when.soon { background: var(--gold); color: var(--gold-ink); }
.job h4 { margin: 0 0 6px; font-size: 1.12rem; font-weight: 600; }
.job-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .9rem; }
.job-meta span { display: inline-flex; align-items: center; gap: 6px; }
.job-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: .92rem; }
.job-h { font: 600 .8rem "Prompt", sans-serif; color: var(--muted); letter-spacing: .2px; margin-bottom: 6px; }
.prep { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.prep li { display: flex; align-items: center; gap: 8px; }
.prep li svg { color: var(--primary); font-size: 1.05rem; }
.tel { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-weight: 600; text-decoration: none; }
.job-note { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: .9rem; }

/* ============ ใบขอใช้และรายงานสำหรับพิมพ์ ============ */
#printSlip, #printReport { display: none; }
@media print {
  body { background: #fff; color: #000; }
  header.top, nav.tabs, main, footer, .chart-tip, dialog { display: none !important; }
  #printReport { display: block; padding: 8px 4px; font-size: 13.5px; }
  #printReport .slip-logo { display: block; width: 80px; height: 80px; margin: 0 auto 6px; }
  #printReport h2 { text-align: center; margin: 0 0 2px; font-size: 1.3rem; }
  #printReport h3 { font-size: 1.02rem; margin: 20px 0 6px; }
  #printReport .c { text-align: center; margin: 0; }
  #printReport .p-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
  #printReport .p-kpis div { border: 1px solid #999; border-radius: 8px; padding: 8px; text-align: center; font-size: .85rem; }
  #printReport .p-kpis b { display: block; font-size: 1.5rem; }
  #printReport .p-table { width: 100%; border-collapse: collapse; }
  #printReport .p-table th, #printReport .p-table td { border: 1px solid #999; padding: 4px 8px; text-align: left; vertical-align: top; }
  #printReport .p-table th { background: #eee; }
  #printReport .p-table .num { text-align: right; }
  #printReport .p-table.small { font-size: .88em; }
  #printReport tr { break-inside: avoid; }
  #printReport .pbar { height: 12px; background: #eee; border-radius: 3px; }
  #printReport .pbar i { display: block; height: 100%; background: #1f3a8a; border-radius: 3px; }
  #printReport .pbar, #printReport .pbar i, #printReport .p-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printReport .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 40px; text-align: center; break-inside: avoid; }
  #printReport .p-foot { text-align: right; font-size: .8rem; color: #555; margin-top: 16px; }
  #printSlip { display: block; padding: 24px; font-size: 15px; }
  #printSlip.memo { display: block; position: relative; }
  #printSlip .slip-logo { display: block; width: 90px; height: 90px; margin: 0 auto 8px; }
  #printSlip h2 { text-align: center; margin-bottom: 4px; }
  #printSlip .c { text-align: center; margin: 0; }
  #printSlip table { width: 100%; border-collapse: collapse; margin-top: 16px; }
  #printSlip td { border: 1px solid #999; padding: 6px 10px; vertical-align: top; }
  #printSlip td:first-child { width: 32%; font-weight: 600; }
  #printSlip .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 48px; text-align: center; }

}
@page memo { size: A4; margin: 0; }

/* ============ บันทึกข้อความ ============ */
/* ใช้ภาพแบบฟอร์มเดิมเต็มหน้า A4 แล้ววางข้อความบนเส้นประตามพิกัด (ดู MEMO_FIELDS ใน common.js) */
#printSlip.memo {
  page: memo; position: relative; width: 210mm; height: 296mm; padding: 0; overflow: hidden;
  background: #fff; color: #000; font-family: "Sarabun", sans-serif; font-size: 16pt;
}
#printSlip.memo.measure { display: block; position: fixed; left: -10000px; top: 0; }
.memo .memo-bg, .memo .memo-svg { position: absolute; left: 0; top: 0; width: 210mm; height: 297mm; }


/* ============ จอขนาดเล็ก ============ */
@media (max-width: 960px) {
  .ov-gauges { grid-template-columns: 1fr 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .rooms, .room-pick, .steps { grid-template-columns: 1fr 1fr; }
  .svc { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; margin: -28px 12px 36px; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { max-width: 420px; }
}
@media (max-width: 600px) {
  .form-grid, .svc, .rooms, .room-pick, .steps, .detail-guide ul { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 32px; }
  .stat { padding: 14px; flex-direction: column; align-items: flex-start; gap: 8px; }
  /* ส่วนหัวบนมือถือ: แถวบน = โลโก้ + ชื่อระบบ / แถวล่าง = ปุ่มชิดขวา */
  header.top .wrap { flex-wrap: wrap; row-gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  header.top .logo { width: 46px; height: 46px; }
  header.top .wrap > div:not(.user-box) { flex: 1 1 calc(100% - 64px); min-width: 0; }
  header.top h1 { font-size: 1rem; }
  header.top p { font-size: .76rem; }
  .user-box { margin-left: auto; }
  .theme-btn, .user-menu summary { padding: 6px 11px; font-size: .82rem; }
  .theme-btn > span:not(.theme-ico) { display: none; }
  .user-box > a.theme-btn > span { display: inline; }
  .user-box { flex-wrap: nowrap; }
  /* เมนูผู้ใช้บนมือถือ: เต็มความกว้างใต้ส่วนหัว (อ้างอิงตำแหน่งจาก header.top) */
  .user-menu { position: static; }
  .user-pop { left: 16px; right: 16px; top: calc(100% - 6px); width: auto; }
  .hero { border-radius: 22px; }
  fieldset.step { padding: 18px; }
  .req-item { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { flex-direction: column; gap: 8px; }
  .cols { height: 180px; gap: 1px; }
  .ov-gauges { grid-template-columns: 1fr 1fr; }
  .ov-donuts { grid-template-columns: 1fr; }
  .user-add { grid-template-columns: 1fr; }
  .user-menu summary span { max-width: 130px; }
  .code-form { flex-direction: column; align-items: center; }
  .donut-wrap { grid-template-columns: 1fr; }
  .donut { width: min(190px, 70%); margin: 0 auto; }
  .gauge { padding: 12px 10px 8px; }
  .g-text { bottom: 8px; }
  .overview { padding: 16px; }
  .col-val { font-size: .66rem; }
  .job { grid-template-columns: 1fr; gap: 12px; }
  .job-date { flex-direction: row; gap: 8px; justify-self: start; padding: 6px 14px; }
  .job-date b { font-size: 1.2rem; }
  .job-cols { grid-template-columns: 1fr; }
  .me-bar { flex-wrap: wrap; }
  .teams { grid-template-columns: 1fr; }
  .dlg form { padding: 18px; }
  .req-actions { align-items: flex-start; }
  .req-actions .btns { justify-content: flex-start; }
  .sched-date { margin-left: 0; width: 100%; }
}
