/* ═══════════════════════════════════════════════════════════════════════════
   ธีมหลัก — มินิมอล พาสเทล น่าเชื่อถือ (ดีไซน์รอบ 3)
   · พื้นหลังพาสเทลมีวงแสงลอยช้าๆ · ปุ่มใช้บ่อย = พาสเทลอ่อน · ปุ่มทึบ 1 ปุ่มต่อหน้า (สีกลางๆ)
   · ธีมสี 4 แบบ: <html data-palette="mint|blue|warm|somsri">  · โหมด: <html data-theme="light|dark"> (ไม่ใส่ = ตามเครื่อง)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── ธีมสี (โหมดสว่าง) ── */
:root, [data-palette="mint"] {
  --bg: #F5F9F8;
  --blob1: #C4EFE6; --blob2: #D4E4FF; --blob3: #DFF5EC;
  --primary: #3E9A8D; --primary-hover: #358A7E;           /* ปุ่มทึบ (สีกลางๆ) */
  --primary-soft: #DDF1EC; --primary-soft-hover: #CDEAE3; /* ปุ่มพาสเทล / พื้นป้าย */
  --primary-text: #1B6B61;                                 /* ตัวอักษรบนพื้นพาสเทล / สีเน้น */
}
[data-palette="blue"] {
  --bg: #F6F8FB;
  --blob1: #C9DCFF; --blob2: #DCD6FF; --blob3: #CDEFFF;
  --primary: #5B7BC4; --primary-hover: #4E6DB5;
  --primary-soft: #E3EBFA; --primary-soft-hover: #D6E2F7;
  --primary-text: #2B4A99;
}
[data-palette="warm"] {     /* Finger Story — พีช ชมพู ฟ้า แบบสุขุม */
  --bg: #FBF8F6;
  --blob1: #FFE0C4; --blob2: #FFD6DE; --blob3: #D9E6FF;
  --primary: #CF7D66; --primary-hover: #BE6E58;
  --primary-soft: #FBE9E2; --primary-soft-hover: #F6DBD0;
  --primary-text: #9A4631;
}
[data-palette="somsri"] {   /* สมศรี — ฟ้า-ม่วงลาเวนเดอร์ แบบสุขุม */
  --bg: #F4F5FD;
  --blob1: #D6DEFF; --blob2: #E4DAFF; --blob3: #D2ECFF;
  --primary: #5A6FE0; --primary-hover: #4D61CF;
  --primary-soft: #E6E9FC; --primary-soft-hover: #D9DEFA;
  --primary-text: #3B47A8;
}

/* ── ค่ากลาง (โหมดสว่าง) ── */
:root {
  --primary-ink: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-glass: rgba(255, 255, 255, .82);
  --text: #1C2333;
  --text-soft: #3E4659;
  --muted: #6B7385;
  --border: #E4E8EF;
  --border-strong: #CDD4DF;
  --danger: #C8372D; --danger-soft: #FCEDEC;
  --warn: #9A5B00;   --warn-soft: #FFF3DC;
  --ok: #1F8A4C;     --ok-soft: #E7F6EC;
  --accent: #9A5B00; --accent-soft: #FFF3DC;   /* สีอุ่นสำหรับป้าย "เร็วๆ นี้" / หมายเหตุ */
  --ring: color-mix(in srgb, var(--primary) 30%, transparent);
  --shimmer: rgba(255, 255, 255, .6);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --shadow: 0 2px 4px rgba(16, 24, 40, .05), 0 12px 28px rgba(16, 24, 40, .08);
  --shadow-lg: 0 24px 60px -16px rgba(16, 24, 40, .25);
  --radius: 18px;
  --radius-sm: 11px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur: 220ms;
  color-scheme: light;
}

/* ── โหมดมืด: ค่ากลาง + ธีมสีที่สว่างขึ้นเล็กน้อย ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1320; --surface: #161C2B; --surface-2: #121826; --surface-glass: rgba(22, 28, 43, .82);
    --text: #E7EBF3; --text-soft: #C3CAD8; --muted: #9AA3B5; --border: #232B3C; --border-strong: #313B50;
    --danger: #F08A80; --danger-soft: rgba(200, 55, 45, .18); --warn: #F2B15C; --warn-soft: rgba(178, 106, 0, .2);
    --ok: #6FCF97; --ok-soft: rgba(31, 138, 76, .2); --accent: #F2B15C; --accent-soft: rgba(178, 106, 0, .2);
    --primary-ink: #0E1320; --shimmer: rgba(255, 255, 255, .05);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); --shadow: 0 12px 28px rgba(0, 0, 0, .4); --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
  :root:not([data-theme="light"]):is([data-palette="mint"], :not([data-palette])) { --primary: #5CC0B0; --primary-hover: #6FCDBE; --primary-soft: rgba(80, 190, 170, .15); --primary-soft-hover: rgba(80, 190, 170, .24); --primary-text: #8FDCCB; }
  :root:not([data-theme="light"])[data-palette="blue"] { --primary: #7F9DE0; --primary-hover: #93ADE8; --primary-soft: rgba(120, 150, 230, .16); --primary-soft-hover: rgba(120, 150, 230, .25); --primary-text: #A9C1F5; }
  :root:not([data-theme="light"])[data-palette="warm"] { --primary: #E59A84; --primary-hover: #EDAA96; --primary-soft: rgba(230, 150, 125, .16); --primary-soft-hover: rgba(230, 150, 125, .25); --primary-text: #F2B9A6; }
  :root:not([data-theme="light"])[data-palette="somsri"] { --primary: #8193F0; --primary-hover: #93A3F4; --primary-soft: rgba(130, 145, 240, .17); --primary-soft-hover: rgba(130, 145, 240, .26); --primary-text: #B3BEFA; }
}
:root[data-theme="dark"] {
  --bg: #0E1320; --surface: #161C2B; --surface-2: #121826; --surface-glass: rgba(22, 28, 43, .82);
  --text: #E7EBF3; --text-soft: #C3CAD8; --muted: #9AA3B5; --border: #232B3C; --border-strong: #313B50;
  --danger: #F08A80; --danger-soft: rgba(200, 55, 45, .18); --warn: #F2B15C; --warn-soft: rgba(178, 106, 0, .2);
  --ok: #6FCF97; --ok-soft: rgba(31, 138, 76, .2); --accent: #F2B15C; --accent-soft: rgba(178, 106, 0, .2);
  --primary-ink: #0E1320; --shimmer: rgba(255, 255, 255, .05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); --shadow: 0 12px 28px rgba(0, 0, 0, .4); --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
:root[data-theme="dark"]:is([data-palette="mint"], :not([data-palette])) { --primary: #5CC0B0; --primary-hover: #6FCDBE; --primary-soft: rgba(80, 190, 170, .15); --primary-soft-hover: rgba(80, 190, 170, .24); --primary-text: #8FDCCB; }
:root[data-theme="dark"][data-palette="blue"] { --primary: #7F9DE0; --primary-hover: #93ADE8; --primary-soft: rgba(120, 150, 230, .16); --primary-soft-hover: rgba(120, 150, 230, .25); --primary-text: #A9C1F5; }
:root[data-theme="dark"][data-palette="warm"] { --primary: #E59A84; --primary-hover: #EDAA96; --primary-soft: rgba(230, 150, 125, .16); --primary-soft-hover: rgba(230, 150, 125, .25); --primary-text: #F2B9A6; }
:root[data-theme="dark"][data-palette="somsri"] { --primary: #8193F0; --primary-hover: #93A3F4; --primary-soft: rgba(130, 145, 240, .17); --primary-soft-hover: rgba(130, 145, 240, .26); --primary-text: #B3BEFA; }

/* ═══════════════════════════════ พื้นฐาน ═══════════════════════════════ */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Prompt', -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.3; letter-spacing: -.3px; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.6px; } h2 { font-size: 18px; font-weight: 600; } h3 { font-size: 15px; font-weight: 500; }
b, strong { font-weight: 600; }
p { margin: 0 0 .75em; }
a { color: var(--primary-text); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 8px; }
.icon { width: 19px; height: 19px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }

/* พื้นหลังพาสเทล: วงแสงลอยช้าๆ (api.js ใส่ <div class="mesh"> ให้ทุกหน้า) */
.mesh { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.mesh i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; transition: background-color .6s ease; }
.mesh i:nth-child(1) { width: 620px; height: 620px; background: var(--blob1); top: -18%; left: -10%; animation: floatBlob 16s infinite alternate ease-in-out; }
.mesh i:nth-child(2) { width: 520px; height: 520px; background: var(--blob2); top: 30%; right: -10%; animation: floatBlob 20s infinite alternate-reverse ease-in-out; }
.mesh i:nth-child(3) { width: 560px; height: 560px; background: var(--blob3); bottom: -25%; left: 25%; animation: floatBlob 24s infinite alternate ease-in-out; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mesh i { opacity: .12; } }
:root[data-theme="dark"] .mesh i { opacity: .12; }

/* ═══════════════════════════════ ฟอร์ม ═══════════════════════════════ */
label { display: block; font-weight: 400; font-size: 13.5px; margin: 16px 0 6px; color: var(--muted); }
input, select {
  width: 100%; padding: 11px 14px; font: inherit; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease, background-color var(--dur) ease;
}
input::placeholder { color: var(--muted); opacity: .75; }
input:hover, select:hover { border-color: var(--border-strong); }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
input[readonly] { background: var(--surface-2); color: var(--text-soft); }
.field-icon { position: relative; }
.field-icon > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.field-icon input { padding-left: 42px; }
.field-icon .toggle-pw { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 8px; border-radius: 8px; display: grid; }
.field-icon .toggle-pw:hover { color: var(--text); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 14.5px; margin: 12px 0; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ═══════════════════════════════ ปุ่ม ═══════════════════════════════ */
/* .btn = ปุ่มรอง (ขาว เส้นขอบบาง) · .btn-soft = ปุ่มพาสเทล (ใช้บ่อย) · .btn-primary = ปุ่มทึบ (1 ปุ่มต่อหน้า) */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 9px 16px; font: inherit; font-weight: 500; font-size: 14px;
  border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background-color var(--dur) ease, border-color var(--dur) ease, color var(--dur) ease, box-shadow var(--dur) ease, transform 120ms ease;
}
.btn:hover { border-color: var(--border-strong); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); border-color: transparent; color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: transparent; }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-text); }
.btn-soft:hover { background: var(--primary-soft-hover); border-color: transparent; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--primary-soft); border-color: transparent; color: var(--primary-text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn-block { width: 100%; min-height: 46px; margin-top: 22px; font-size: 15px; }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.btn-icon { min-height: 40px; width: 40px; padding: 0; }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ''; position: absolute; width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid var(--primary-text); border-right-color: transparent; border-bottom-color: transparent;
  animation: spin .7s linear infinite;
}
.btn-primary.loading::after { border-color: var(--primary-ink); border-right-color: transparent; border-bottom-color: transparent; }
/* ระลอกคลื่นตอนกด (สร้างจาก api.js) */
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .12; animation: ripple 600ms var(--ease-out); pointer-events: none; }

/* ═══════════════════════════════ ข้อความแจ้ง ═══════════════════════════════ */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); margin: 14px 0; font-size: 14px; animation: fade-up 260ms var(--ease-out); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px;
  padding: 12px 16px; border-radius: 14px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 14px; pointer-events: auto;
  animation: toast-in 380ms var(--ease-out);
}
.toast .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast.ok .dot { background: var(--ok-soft); color: var(--ok); }
.toast.error .dot { background: var(--danger-soft); color: var(--danger); }
.toast.leaving { animation: toast-out 240ms ease-in forwards; }

/* ═══════════════════════════════ หน้าล็อกอิน / รับคำเชิญ ═══════════════════════════════ */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero { position: relative; overflow: hidden; padding: 48px; color: var(--text); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-hero .blob, .auth-hero .grid-lines { display: none; }
.auth-hero > * { position: relative; }
.hero-brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 17px; }
.hero-mark { width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; }
.hero-copy h2 { font-size: 36px; line-height: 1.25; font-weight: 600; letter-spacing: -1px; margin-bottom: 14px; max-width: 460px; }
.hero-copy p { color: var(--muted); max-width: 420px; font-size: 16px; }
.hero-points { display: grid; gap: 12px; margin-top: 28px; max-width: 420px; }
.hero-point {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 14px;
  background: var(--surface-glass); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: fade-up 600ms var(--ease-out) both;
}
.hero-point .icon { color: var(--primary-text); }
.hero-point:nth-child(2) { animation-delay: 120ms; } .hero-point:nth-child(3) { animation-delay: 240ms; }
.hero-foot { font-size: 13px; color: var(--muted); }

.auth-main { display: grid; place-items: center; padding: 32px 20px; position: relative; }
.auth-card {
  width: 100%; max-width: 420px; padding: 34px; border-radius: 22px;
  background: var(--surface-glass); border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  animation: fade-up 500ms var(--ease-out);
}
.auth-card h1 { font-size: 26px; }
.auth-mobile-brand { display: none; }
.brand-mark-sm { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); display: grid; place-items: center; color: var(--primary-text); }
.clinic-option {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; margin-top: 10px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; cursor: pointer; font: inherit; color: var(--text);
  transition: border-color var(--dur) ease, transform var(--dur) var(--ease-out), box-shadow var(--dur) ease;
  animation: fade-up 400ms var(--ease-out) both;
}
.clinic-option:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.clinic-option .grow { flex: 1; }
.theme-corner { position: absolute; top: 16px; right: 16px; }

/* ═══════════════════════════════ โครงหน้าหลัก ═══════════════════════════════ */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px;
  padding: 22px 14px; background: var(--surface-glass); border-right: 1px solid var(--border); overflow-y: auto;
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 20px; }
.side-brand .mark { width: 38px; height: 38px; border-radius: 11px; background: var(--primary-soft); display: grid; place-items: center; color: var(--primary-text); flex-shrink: 0; }
.side-brand .clinic { font-weight: 600; line-height: 1.25; font-size: 15px; }
.side-brand .types { font-size: 12px; color: var(--muted); }
.nav-label { font-size: 11px; font-weight: 500; letter-spacing: .06em; color: var(--muted); padding: 16px 12px 6px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-size: 14.5px;
  transition: background-color var(--dur) ease, color var(--dur) ease;
}
.nav-link:hover { background: color-mix(in srgb, var(--muted) 10%, transparent); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 500; }
.nav-link.active::before {
  content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--primary); animation: grow-y 300ms var(--ease-out);
}
.nav-link .badge-teal { background: var(--primary-soft); color: var(--primary-text); }
.nav-link.active .badge-teal { background: var(--surface); }
.nav-link .soon { margin-left: auto; white-space: nowrap; font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); }
.nav-link.disabled { opacity: .55; cursor: default; }
.nav-link.disabled:hover { background: none; color: var(--muted); }
.side-foot { margin-top: auto; padding-top: 12px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.user-card .info { flex: 1; min-width: 0; }
.user-card .name { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .role { font-size: 12px; color: var(--muted); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 30px; background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.crumb { font-weight: 500; display: flex; align-items: center; gap: 10px; }
.crumb .menu-btn { display: none; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
main { padding: 30px; max-width: 1200px; width: 100%; min-width: 0; }
.page { animation: page-in 460ms var(--ease-out); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.card {
  background: var(--surface-glass); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 18px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: box-shadow var(--dur) ease, border-color var(--dur) ease, background-color var(--dur) ease;
}
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.card-head .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex-shrink: 0; }
.card-head h2 { margin: 0; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

/* หน้าหลัก: หัวเรียบ ไม่มีแถบสี */
.welcome { position: relative; margin: 4px 0 26px; }
.welcome .blob { display: none; }
.welcome h1 { font-size: 30px; margin: 10px 0 4px; }
.welcome p { color: var(--muted); margin: 0; }
.welcome .date-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); font-size: 12.5px; font-weight: 500; }
.welcome .date-chip .icon { width: 14px; height: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  display: flex; gap: 16px; align-items: center; padding: 20px; border-radius: var(--radius);
  background: var(--surface-glass); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) ease;
  animation: fade-up 500ms var(--ease-out) both;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; background: var(--primary-soft); color: var(--primary-text); }
.stat .ic.orange { background: var(--warn-soft); color: var(--warn); }
.stat .ic.green { background: var(--ok-soft); color: var(--ok); }
.stat .num { font-size: 28px; font-weight: 600; letter-spacing: -.5px; line-height: 1.1; }
.stat .lbl { font-size: 13.5px; color: var(--muted); }
.roadmap { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.road-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface-2); }
.road-item .icon { color: var(--primary-text); margin-top: 2px; }
.road-item strong { display: block; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ═══════════════════════════════ ตาราง ═══════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 500; background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
tbody tr { transition: background-color var(--dur) ease; }
tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 45%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.enter { animation: fade-up 380ms var(--ease-out) both; }
tr.inactive td { opacity: .6; }
.person { display: flex; align-items: center; gap: 12px; }
.person .name { font-weight: 500; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* รูปประจำตัว: พาสเทลอ่อน ตัวอักษรสีตามคน */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-weight: 600; font-size: 15px; color: var(--a1, var(--primary-text));
  background: color-mix(in srgb, var(--a1, var(--primary)) 14%, var(--surface));
}
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-xl { width: 84px; height: 84px; font-size: 30px; }
.av-card { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); border: 0; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-off { background: var(--danger-soft); color: var(--danger); }
.badge-teal { background: var(--primary-soft); color: var(--primary-text); }
.live-dot::before { animation: pulse 1.8s ease-in-out infinite; }

.skeleton { position: relative; overflow: hidden; background: color-mix(in srgb, var(--muted) 10%, transparent); border-radius: 8px; height: 14px; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--shimmer), transparent); animation: shimmer 1.3s infinite; }

/* ═══════════════════════════════ หน้าต่างลอย ═══════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: rgba(14, 19, 32, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in 200ms ease;
}
.modal {
  width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; padding: 26px;
  background: var(--surface); border-radius: 22px; border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: modal-in 360ms var(--ease-out);
}
.modal-backdrop.closing { animation: fade-out 180ms ease forwards; }
.modal-backdrop.closing .modal { animation: modal-out 180ms ease-in forwards; }
.modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.modal-head h2 { margin: 0; }
.modal-actions { position: sticky; bottom: -26px; display: flex; justify-content: flex-end; gap: 10px; margin: 22px -26px -26px; padding: 16px 26px; background: var(--surface); border-top: 1px solid var(--border); flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 24px 0 4px; font-weight: 600; }
.perm-group { margin-top: 14px; padding: 4px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.perm-group h3 { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .04em; margin: 10px 0 2px; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.perm-row:last-child { border-bottom: 0; }
.perm-row .note { font-size: 12px; color: var(--warn); }
.copy-box { display: flex; gap: 8px; margin-top: 10px; }
.copy-box input { font-size: 13px; }
.link-hero { text-align: center; padding: 6px 0 4px; }
.check-anim { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; animation: pop 500ms var(--ease-spring); }
.check-anim svg { width: 30px; height: 30px; }
.check-anim path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw 500ms 200ms ease-out forwards; }

/* สวิตช์ */
.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background-color var(--dur) ease; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform 280ms var(--ease-spring); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px var(--ring); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .5; }

/* ═══════════════════════════════ สลับผู้ใช้ด้วย PIN ═══════════════════════════════ */
.lock-screen { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; overflow-y: auto; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); animation: fade-in 260ms ease; }
.lock-card { width: 100%; max-width: 560px; text-align: center; }
.lock-card > div { animation: fade-up 380ms var(--ease-out); }
.lock-clock { font-size: 56px; font-weight: 500; letter-spacing: -1.5px; line-height: 1; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 24px 0; }
.user-tile {
  padding: 18px 10px; border-radius: 18px; background: var(--surface-glass); border: 1px solid var(--border); cursor: pointer; font: inherit; color: var(--text);
  transition: transform var(--dur) var(--ease-out), border-color var(--dur) ease, box-shadow var(--dur) ease;
  animation: fade-up 400ms var(--ease-out) both;
}
.user-tile:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow); }
.user-tile .avatar { margin: 0 auto 10px; }
#lock-avatar .avatar { margin: 0 auto; }
.user-tile .nm { font-weight: 500; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 22px 0; }
.pin-dots i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--primary); display: block; transition: background-color 150ms ease, transform 200ms var(--ease-spring); }
.pin-dots i.on { background: var(--primary); transform: scale(1.12); }
.pin-dots.shake { animation: shake 420ms ease; }
.pin-dots.shake i { border-color: var(--danger); }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; }
.keypad button { height: 64px; font-size: 22px; font-weight: 500; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit; transition: background-color 150ms ease, transform 120ms ease, border-color 150ms ease; }
.keypad button:hover { border-color: var(--primary); }
.keypad button:active { transform: scale(.92); background: var(--primary-soft); }
.keypad button.fn { border-color: transparent; background: transparent; font-size: 14px; color: var(--muted); }
.lock-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

/* ═══════════════════════════════ เลือกธีมสี (บัญชีของฉัน) ═══════════════════════════════ */
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.palette-card { position: relative; text-align: left; padding: 12px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); transition: border-color var(--dur) ease, transform var(--dur) var(--ease-out); }
.palette-card:hover { transform: translateY(-2px); }
.palette-card.on { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.palette-card .preview { height: 64px; border-radius: 10px; margin-bottom: 10px; position: relative; overflow: hidden; }
.palette-card .preview .bar { position: absolute; left: 10px; bottom: 10px; width: 46%; height: 12px; border-radius: 6px; }
.palette-card .preview .pill { position: absolute; right: 10px; bottom: 10px; width: 28%; height: 12px; border-radius: 6px; }
.palette-card .name { font-weight: 500; font-size: 14px; }
.palette-card .desc { font-size: 12px; color: var(--muted); }
.palette-card .tick { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: none; place-items: center; }
.palette-card.on .tick { display: grid; }
.palette-card .tick .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.seg-mode { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); margin-top: 6px; }
.seg-mode button { font: inherit; font-size: 14px; padding: 7px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg-mode button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 500; }

/* ═══════════════════════════════ ภาพเคลื่อนไหว ═══════════════════════════════ */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes page-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }
@keyframes floatBlob { from { transform: translate(0, 0) scale(1); } to { transform: translate(40px, 30px) scale(1.08); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .mesh i { animation: none !important; }
}

/* ═══════════════════════════════ จอเล็ก ═══════════════════════════════ */
@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-mobile-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 24px; }
  .auth-card { padding: 26px 22px; }
  .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 45; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform 320ms var(--ease-out); box-shadow: var(--shadow-lg); background: var(--surface); }
  .app.nav-open .sidebar { transform: none; }
  .nav-scrim { position: fixed; inset: 0; z-index: 44; background: rgba(14, 19, 32, .3); animation: fade-in 200ms ease; }
  .crumb .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  main { padding: 18px 16px; }
  .hide-sm { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  th, td { padding: 12px; }
  .toast-stack { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
  .keypad { grid-template-columns: repeat(3, 70px); }
  .lock-clock { font-size: 44px; }
  .welcome h1 { font-size: 24px; }
}

/* ═══════════════════════════════ ลูกค้าและสัตว์เลี้ยง ═══════════════════════════════ */
.search-hero { position: relative; margin-bottom: 14px; }
.search-hero > .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--muted); pointer-events: none; }
.search-hero input { padding: 16px 18px 16px 52px; font-size: 17px; border-radius: 14px; box-shadow: var(--shadow-sm); }
.section-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; margin: 0 0 10px; }
.result { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); cursor: pointer; text-decoration: none; color: inherit; transition: background-color var(--dur) ease; animation: fade-up 360ms var(--ease-out) both; }
.result:hover { background: var(--surface-2); }
.result:last-child { border-bottom: 0; }
.result .grow { flex: 1; min-width: 0; }
.result .name { font-weight: 600; }
.result mark { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 2px; }
.pet-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; margin: 4px 4px 0 0; color: var(--text); }
.pet-chip .dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.pet-chip .dot .icon { width: 13px; height: 13px; }
.pet-chip.warn { border-color: var(--danger); }
.pet-chip.gone { opacity: .55; }

.species { display: flex; gap: 8px; flex-wrap: wrap; }
.species button { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; min-height: 40px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; transition: all var(--dur) ease; }
.species button:hover { border-color: var(--border-strong); }
.species button.on { border-color: transparent; background: var(--primary-soft); color: var(--primary-text); font-weight: 500; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { font: inherit; font-size: 13px; padding: 6px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }
.pet-block { position: relative; padding: 20px 18px 18px; border: 1.5px dashed var(--border-strong); border-radius: 14px; margin-top: 18px; background: var(--surface-2); animation: fade-up 360ms var(--ease-out); }
.pet-block .badge-num { position: absolute; top: -12px; left: 16px; }
.pet-block .remove { position: absolute; top: 8px; right: 8px; }
.photo-drop { position: relative; width: 96px; height: 96px; border-radius: 16px; border: 1.5px dashed var(--border-strong); display: grid; place-items: center; color: var(--muted); background: var(--surface); cursor: pointer; text-align: center; font-size: 12px; overflow: hidden; flex-shrink: 0; transition: border-color var(--dur) ease; }
.photo-drop:hover { border-color: var(--primary); color: var(--primary); }
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dup-warn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); margin-top: 10px; font-size: 14px; animation: fade-up 300ms var(--ease-out); flex-wrap: wrap; }
.dup-warn .grow { flex: 1; min-width: 180px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.consent { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); margin-top: 18px; }
.sticky-save { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 35%); }
.age-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.age-row input[type="number"] { width: 84px; }
.age-row input[type="date"] { width: 180px; }

.owner-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.owner-head .grow { flex: 1; min-width: 200px; }
.contact { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; color: var(--text-soft); font-size: 14px; }
.contact span { display: inline-flex; align-items: center; gap: 6px; }
.contact .icon { width: 16px; height: 16px; }
.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.pet-card { position: relative; display: block; padding: 18px; border-radius: 18px; background: var(--surface-glass); border: 1px solid var(--border); box-shadow: var(--shadow-sm); cursor: pointer; text-decoration: none; color: inherit; transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) ease, border-color var(--dur) ease; animation: fade-up 420ms var(--ease-out) both; }
.pet-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.pet-card.dim { opacity: .55; filter: grayscale(1); }
.pet-photo { position: relative; overflow: hidden; width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; color: var(--a1, var(--primary-text)); font-size: 24px; font-weight: 600; flex-shrink: 0; background: color-mix(in srgb, var(--a1, var(--primary)) 14%, var(--surface)); }
.pet-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pet-photo-lg { width: 84px; height: 84px; border-radius: 20px; font-size: 32px; }
.pet-card .top { display: flex; gap: 14px; align-items: center; }
.pet-card .pname { font-weight: 600; font-size: 16px; }
.pet-card .meta { font-size: 13px; color: var(--muted); }
.pet-card .stats { display: flex; gap: 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pet-card .stats b { display: block; font-size: 15px; color: var(--text); }
.alert-pill { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; padding: 4px 10px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 12px; font-weight: 600; }
.alert-pill .icon { width: 14px; height: 14px; }
.add-pet-card { display: grid; place-items: center; text-align: center; min-height: 170px; border: 1.5px dashed var(--border-strong); background: transparent; box-shadow: none; color: var(--muted); font: inherit; }
.add-pet-card:hover { color: var(--primary); border-color: var(--primary); }
.placeholder { padding: 18px; border-radius: 14px; border: 1.5px dashed var(--border-strong); color: var(--muted); text-align: center; font-size: 14px; }
.archived-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); margin-bottom: 16px; flex-wrap: wrap; }
.archived-banner .grow { flex: 1; }

.danger-banner { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px; background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); margin-bottom: 18px; animation: fade-up 300ms var(--ease-out); }
.danger-banner .icon { width: 24px; height: 24px; }
.danger-banner b { display: block; }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 16px 0 18px; overflow-x: auto; }
.tabs-line button { font: inherit; font-weight: 500; padding: 10px 14px; border: 0; background: none; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tabs-line button.on { color: var(--primary-text); border-bottom-color: var(--primary); font-weight: 500; }
.tabs-line button:disabled { cursor: default; }
.tabs-line .soon { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-left: 4px; }
dl.info { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; font-weight: 500; }
dl.info dd.alert-text { color: var(--danger); }
.chart-box { width: 100%; height: 190px; display: block; }
.chart-box .line { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw-line 1.2s var(--ease-out) forwards; }
.chart-box .area { fill: var(--primary-soft); opacity: .7; }
.chart-box .pt { fill: var(--surface); stroke: var(--primary); stroke-width: 2.5; }
.chart-box text { fill: var(--muted); font-size: 11px; font-family: inherit; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.weight-list { margin-top: 10px; font-size: 13px; color: var(--muted); }

@media (max-width: 900px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
  dl.info { grid-template-columns: 110px 1fr; }
}

/* ═══════════════════════════════ คิวและเปิดเคส ═══════════════════════════════ */
.board-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.chips-filter { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.chips-filter button { font: inherit; font-size: 14px; padding: 7px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.chips-filter button.on { background: var(--primary-soft); color: var(--primary-text); font-weight: 500; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ok); margin-left: auto; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.8s infinite; }
.live.off { color: var(--muted); }
.live.off i { background: var(--muted); animation: none; }
main:has(.board) { max-width: none; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: color-mix(in srgb, var(--surface) 45%, transparent); border: 1px solid var(--border); border-radius: 18px; padding: 12px; min-height: 260px; }
.col-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; padding: 2px 4px 10px; }
.col-head .count { width: auto; margin-left: auto; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font-size: 12px; background: var(--surface); border: 1px solid var(--border); }
.col-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.col-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 8px; }
.qcard { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 13px; margin-bottom: 10px; box-shadow: none; cursor: pointer; animation: fade-up 360ms var(--ease-out) both; transition: border-color var(--dur) ease, box-shadow var(--dur) ease; }
.qcard:hover { box-shadow: var(--shadow); }
.qcard.late { border-left: 3px solid var(--warn); }
.qcard .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qcard .row .wait { flex-basis: 100%; margin: -4px 0 0 50px; }
.qno { min-width: 40px; height: 40px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; font-weight: 600; font-size: 17px; background: var(--primary-soft); color: var(--primary-text); flex-shrink: 0; }
.qno.svc { background: var(--warn-soft); color: var(--warn); }
.qno.ok { background: var(--ok-soft); color: var(--ok); }
.qcard .who { min-width: 0; flex: 1; }
.qcard .pet { font-weight: 500; }
.qcard .owner { font-size: 12px; color: var(--muted); }
.qcard .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.qcard .reason { font-size: 13px; color: var(--text-soft); margin-top: 8px; }
/* วินิจฉัย + ยาที่หมอสั่ง บนการ์ดคิว */
.qcard .qrx { margin-top: 10px; padding: 9px 11px; border-radius: 12px; background: var(--surface-2); font-size: 13px; display: grid; gap: 4px; }
.qcard .qrx-pet { font-weight: 600; font-size: 12px; color: var(--muted); }
.qcard .qrx-dx, .qcard .qrx-item { display: flex; gap: 6px; align-items: flex-start; line-height: 1.45; }
.qcard .qrx-dx { font-weight: 600; }
.qcard .qrx .icon { flex: none; margin-top: 2px; color: var(--muted); }
.qcard .qrx-item b { font-weight: 600; white-space: nowrap; }
.qcard .qrx-more { color: var(--muted); font-size: 12px; padding-left: 22px; }
.wait { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.wait .icon { width: 13px; height: 13px; }
.qcard.late .wait { color: var(--warn); font-weight: 600; }
.qcard .actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.qcard .actions .btn { flex: 1 1 auto; min-width: max-content; white-space: nowrap; }
.group-pets { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; display: grid; gap: 6px; }
.group-pets .gp { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.mini-photo { position: relative; overflow: hidden; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--a1, var(--primary-text)); font-size: 12px; font-weight: 600; flex-shrink: 0; background: color-mix(in srgb, var(--a1, var(--primary)) 14%, var(--surface)); }
.mini-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.alert-dot { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--danger); background: var(--danger-soft); padding: 2px 8px; border-radius: 999px; }
.alert-dot .icon { width: 12px; height: 12px; }
.screened { font-size: 11px; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 2px 8px; border-radius: 999px; }
.col.done .qcard { opacity: .75; }
.mobile-tabs { display: none; }
.pick-pet { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1.5px solid var(--border); margin-top: 10px; cursor: pointer; transition: border-color var(--dur) ease, background-color var(--dur) ease; }
.pick-pet.on { border-color: var(--primary); background: var(--primary-soft); }
.pick-pet.off { opacity: .55; cursor: not-allowed; }
.pick-pet input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }

.type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-card { padding: 14px; border-radius: 12px; border: 1.5px solid var(--border); cursor: pointer; text-align: left; background: var(--surface); font: inherit; color: var(--text); }
.type-card.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.type-card b { display: block; }
.next-q { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--border-strong); margin-top: 18px; }
.vitals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.vital { padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); transition: border-color var(--dur) ease, background-color var(--dur) ease; }
.vital label { margin: 0 0 6px; font-size: 13px; }
.vital .unit { font-size: 12px; color: var(--muted); margin-top: 4px; }
.vital.bad { border-color: var(--danger); background: var(--danger-soft); }
.vital.bad .unit { color: var(--danger); font-weight: 600; }
.visit-pet { padding: 14px; border-radius: 14px; border: 1px solid var(--border); margin-top: 12px; }
.visit-pet .top { display: flex; align-items: center; gap: 12px; }
.visit-pet .vit { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.visit-pet .vit b { color: var(--text); }
.visit-pet .vit b.bad { color: var(--danger); }
.visit-pet .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

@media (max-width: 900px) {
  .board { display: block; }
  .col { display: none; min-height: 0; }
  .col.show-m { display: block; }
  .mobile-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
  .mobile-tabs button { font: inherit; font-size: 13px; white-space: nowrap; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
  .mobile-tabs button.on { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; font-weight: 500; }
  .vitals { grid-template-columns: 1fr 1fr; }
  .type-cards { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════ ตั้งค่าคลินิก ═══════════════════════════════ */
.set-layout { display: grid; grid-template-columns: 230px 1fr; gap: 22px; align-items: start; }
.set-tabs { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: var(--radius); background: var(--surface-glass); border: 1px solid var(--border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.set-tab { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 0; background: none; font: inherit; font-size: 14.5px; color: var(--muted); cursor: pointer; text-align: left; transition: background-color var(--dur) ease, color var(--dur) ease; }
.set-tab:hover { background: color-mix(in srgb, var(--muted) 10%, transparent); color: var(--text); }
.set-tab.on { background: var(--primary-soft); color: var(--primary-text); font-weight: 500; }
.set-tab .dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.tag-later { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 500; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); margin-left: 8px; vertical-align: middle; }
.tag-now { background: var(--ok-soft); color: var(--ok); }
.set-panel h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.hint.ok { color: var(--ok); } .hint.bad { color: var(--danger); }
.logo-drop { display: flex; align-items: center; gap: 16px; margin-top: 6px; flex-wrap: wrap; }
.logo-box { position: relative; overflow: hidden; width: 72px; height: 72px; border-radius: 18px; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; border: 1px dashed var(--border-strong); flex-shrink: 0; }
.logo-box img, .side-brand .mark img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.side-brand .mark { position: relative; overflow: hidden; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.seg button { font: inherit; font-size: 14px; padding: 7px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 500; }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding: 14px 0 6px; background: linear-gradient(transparent, var(--bg) 40%); }
.save-bar .unsaved { margin-right: auto; display: none; align-items: center; gap: 8px; font-size: 13.5px; color: var(--warn); }
.save-bar.dirty .unsaved { display: inline-flex; }
.bill-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.receipt { position: sticky; top: 84px; background: #fff; color: #111; border-radius: 6px; padding: 18px 16px; font-size: 12px; line-height: 1.5; box-shadow: var(--shadow); border: 1px solid var(--border); }
.receipt .c { text-align: center; }
.receipt hr { border: 0; border-top: 1px dashed #bbb; margin: 8px 0; }
.receipt .r { display: flex; justify-content: space-between; gap: 8px; }
.receipt .rlogo { position: relative; overflow: hidden; width: 36px; height: 36px; border-radius: 9px; margin: 0 auto 6px; background: #EEF2F1; color: #444; display: grid; place-items: center; }
.receipt .rlogo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.channel { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.channel:last-child { border-bottom: 0; }
.channel .l { display: flex; align-items: center; gap: 12px; }
.channel .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex-shrink: 0; }
.qr-test { display: flex; gap: 16px; align-items: center; margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--border-strong); flex-wrap: wrap; }
.qr-box { width: 120px; height: 120px; border-radius: 8px; background: #fff; display: grid; place-items: center; color: #999; font-size: 12px; text-align: center; padding: 4px; }
.qr-box svg { width: 100%; height: 100%; }
.bank-row { display: grid; grid-template-columns: 1.2fr 1.2fr 1.4fr auto; gap: 10px; align-items: end; margin-top: 10px; }
.hours-row { display: grid; grid-template-columns: 100px 50px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.hours-row:last-child { border-bottom: 0; }
.hours-row .day { font-weight: 500; }
.hours-row .ranges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hours-row .range { display: inline-flex; gap: 6px; align-items: center; }
.hours-row input[type=time] { width: 118px; padding: 8px 10px; }
.hours-row .closed { color: var(--muted); font-size: 13.5px; }
.holiday { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); margin-top: 8px; font-size: 14px; }
.holiday .grow { flex: 1; }
.open-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: var(--ok-soft); color: var(--ok); }
.open-chip.closed { background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); }
.open-chip.warn { background: var(--warn-soft); color: var(--warn); }
.open-chip .icon { width: 14px; height: 14px; }
.welcome .chips-row { display: flex; gap: 8px; flex-wrap: wrap; }
textarea { width: 100%; font: inherit; font-size: 14px; line-height: 1.6; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); min-height: 150px; resize: vertical; transition: border-color var(--dur) ease, box-shadow var(--dur) ease; }
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.version-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; flex-wrap: wrap; }
.version-row:last-child { border-bottom: 0; }
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.team-stat { padding: 16px; border-radius: 14px; background: var(--surface-2); }
.team-stat .n { font-size: 26px; font-weight: 600; }
.consent-text { margin-top: 8px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; color: var(--text-soft); white-space: pre-wrap; max-height: 160px; overflow-y: auto; }
@media (max-width: 1200px) { .bill-grid { grid-template-columns: 1fr; } .receipt { position: static; max-width: 340px; } }
@media (max-width: 960px) {
  .set-layout { grid-template-columns: 1fr; }
  .set-tabs { position: static; flex-direction: row; overflow-x: auto; }
  .set-tab { white-space: nowrap; }
  .grid-2, .grid-3, .bank-row, .team-grid { grid-template-columns: 1fr; }
  .hours-row { grid-template-columns: 1fr auto; }
  .hours-row .ranges { grid-column: 1 / -1; }
}

/* ═══════════════ เวชระเบียนและวัคซีน ═══════════════ */
/* ── หน้าตรวจ ── */
.exam-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.exam-head .grow { flex: 1; min-width: 220px; }
.exam-head h1 { margin: 0; font-size: 24px; }
.danger-strip { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 18px; padding: 10px 14px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 500; }
.danger-strip .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.exam-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.soap-step { display: flex; gap: 12px; align-items: flex-start; }
.soap-letter { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 600; background: var(--primary-soft); color: var(--primary-text); flex-shrink: 0; }
.soap-step .body { flex: 1; min-width: 0; }
.soap-step h3 { margin: 4px 0 6px; font-size: 16px; }
.soap-step textarea { min-height: 70px; }
.vit-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.vit { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.vit .k { font-size: 12px; color: var(--muted); }
.vit .v { font-size: 18px; font-weight: 600; }
.vit.high { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-soft); }
.vit.high .v { color: var(--warn); }
.dx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dx-chips button { font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--border); background: transparent; color: var(--muted); cursor: pointer; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.plan-table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.plan-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.plan-table .type { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); white-space: nowrap; }
.plan-table .type.vac { background: var(--ok-soft); color: var(--ok); }
.plan-table .type.svc { background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); }
.dose-box { margin-top: 12px; padding: 14px; border-radius: 14px; border: 1.5px solid var(--primary); background: var(--primary-soft); }
.dose-box .calc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; margin-top: 6px; }
.dose-box .eq { font-size: 20px; font-weight: 600; color: var(--primary-text); }
.exam-foot { position: sticky; bottom: 12px; margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); box-shadow: var(--shadow); }
.exam-foot .saved { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: 13px; }
.exam-foot .saved .icon { width: 15px; height: 15px; }
.exam-foot .sp { flex: 1; }
.side-stack { display: grid; gap: 14px; position: sticky; top: 64px; }
.tl { list-style: none; margin: 8px 0 0; padding: 0; }
.tl li { position: relative; padding: 0 0 14px 20px; font-size: 13.5px; }
.tl li::before { content: ''; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.tl li::after { content: ''; position: absolute; left: 7.5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.tl li:last-child::after { display: none; }
.tl .d { color: var(--muted); font-size: 12px; }
.spark { width: 100%; height: 70px; margin-top: 6px; }
.spark path { fill: none; stroke: var(--primary); stroke-width: 2; }
.spark circle { fill: var(--primary); }

/* ── สมุดวัคซีน ── */
.due-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.due-card { padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.due-card .when { font-size: 13px; margin-top: 4px; }
.due-card.over { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.due-card.over .when { color: var(--danger); font-weight: 500; }
.due-card.soon .when { color: var(--warn); font-weight: 500; }
.book { width: 100%; border-collapse: collapse; font-size: 14px; }
.book th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.book td { padding: 10px 8px; border-bottom: 1px solid var(--border); }

/* ── รายการยา ── */
.cat-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.cat-tools input { max-width: 280px; }
.cat-list { width: 100%; border-collapse: collapse; font-size: 14px; }
.cat-list th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.cat-list td { padding: 12px 8px; border-bottom: 1px solid var(--border); }
.cat-list tr:hover td { background: var(--primary-soft); cursor: pointer; }
.form-box { margin-top: 18px; }
.fieldset { margin-top: 16px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); }
.fieldset legend, .fieldset .lg { font-weight: 500; font-size: 14px; }

/* ── รายชื่อโทรตาม ── */
.call-row { display: flex; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.call-row .grow { flex: 1; min-width: 200px; }
.call-row .what { font-size: 13px; color: var(--muted); }
.call-row .late { color: var(--danger); font-size: 13px; font-weight: 500; }
.call-row .soonx { color: var(--warn); font-size: 13px; font-weight: 500; }
.sum-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }

/* ── ตั้งค่าเวชระเบียน ── */
.prog { width: 100%; border-collapse: collapse; font-size: 14px; }
.prog td, .prog th { padding: 8px; border-bottom: 1px solid var(--border); text-align: left; }
.prog th { font-weight: 500; font-size: 12px; color: var(--muted); }
.prog input { padding: 6px 8px; }
.range-row { display: grid; grid-template-columns: 140px repeat(3, minmax(0, 1fr)); gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.range-row input { padding: 6px 8px; }
.review-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; margin-bottom: 14px; }
.review-note .icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; }

@media (max-width: 1100px) {
  .exam-grid { grid-template-columns: 1fr; }
  .side-stack { position: static; }
}
@media (max-width: 720px) {
  .vit-row, .due-grid, .sum-row { grid-template-columns: 1fr 1fr; }
  .range-row { grid-template-columns: 1fr 1fr; }
  .plan-table .hide-m, .book .hide-m, .cat-list .hide-m { display: none; }
  .soap-step { gap: 8px; }
  .soap-letter { width: 26px; height: 26px; font-size: 13px; border-radius: 8px; }
  .soap-step .body { margin-left: -34px; }
  .soap-step h3 { margin: 2px 0 10px 34px; }
  .exam-foot { padding: 10px; gap: 8px; }
  .exam-foot .sp { display: none; }
  .exam-foot .saved { width: 100%; }
  .exam-foot .btn { flex: 1; justify-content: center; }
  .exam-head .pet-photo-lg { width: 56px; height: 56px; font-size: 22px; border-radius: 16px; }
}

/* ── เพิ่มเติมของหน้าจริง ── */
.exam-head h1 .sub { color: var(--muted); font-size: 15px; font-weight: 400; }
.exam-head a { color: inherit; }
.exam-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.exam-main { display: grid; gap: 14px; min-width: 0; }
.side-h { font-size: 16px; margin: 0; }
.tl a { color: var(--text); text-decoration: none; }
.tl a:hover b { color: var(--primary-text); }
.tl .d.late { color: var(--danger); font-weight: 500; }
.tl-lg li { padding-bottom: 18px; font-size: 14.5px; }
.exam-foot .saved.muted { color: var(--muted); }
.exam-foot .saved.warn { color: var(--warn); }
.exam-foot .saved.bad { color: var(--danger); }
.pick-wrap { position: relative; }
.pick-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; max-height: 320px; overflow-y: auto; }
.pick-list button { display: flex; width: 100%; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.pick-list button:last-child { border-bottom: 0; }
.pick-list button:hover, .pick-list button:focus-visible { background: var(--primary-soft); }
.dose-box.danger { border-color: var(--danger); background: var(--danger-soft); }
.att-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.att { position: relative; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.att img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-del { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--danger); cursor: pointer; }
.att-del .icon { width: 14px; height: 14px; }
.att-vis { position: absolute; bottom: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; border: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); cursor: pointer; opacity: .9; }
.att-vis.on { background: var(--primary); color: #fff; }
.att-vis .icon { width: 14px; height: 14px; }
.att-add { cursor: pointer; margin: 0; }
.plan-table .row-actions { white-space: nowrap; text-align: right; }
.version-block { margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); display: grid; gap: 8px; }
.tpl-list { display: grid; gap: 8px; margin-top: 14px; }
.cat-list tr.off td { color: var(--muted); }
.seg-wrap { flex-wrap: wrap; height: auto; }
.prog input, .prog select { min-width: 70px; }
.prog td:first-child input { min-width: 140px; }
.fieldset[hidden] { display: none; }
#due-list:empty { display: none; }
#set-panel { min-width: 0; }
#set-panel .card-head { flex-wrap: wrap; }
.prog select { min-width: 150px; }
.prog th { white-space: nowrap; }
.cat-tools .chips-filter, #due-range { flex-wrap: wrap; }
.cat-tools input { max-width: 100%; }
@media (max-width: 720px) { .cat-tools input { flex: 1 1 100%; } }

/* ═══════════════ ช่องเลือกวันที่ พ.ศ. (thaidate.js) ═══════════════ */
.thd-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px; font: inherit; color: var(--text); text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); transition: border-color var(--dur) ease, box-shadow var(--dur) ease; }
.thd-btn:hover { border-color: var(--border-strong); }
.thd-btn:focus-visible, .thd-btn[aria-expanded="true"] { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.thd-btn:disabled { background: var(--surface-2); color: var(--text-soft); cursor: default; }
.thd-btn .ph { color: var(--muted); }
.thd-btn .icon { color: var(--muted); flex-shrink: 0; }
.thd-pop { position: fixed; z-index: 70; width: 320px; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: fade-in 140ms ease; }
.thd-head { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.thd-head select { padding: 6px 8px; font-size: 14px; }
.thd-head select[data-pick="y"] { width: 86px; flex-shrink: 0; }
.thd-nav { width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; border: 0; background: transparent; color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.thd-nav:hover:not(:disabled) { background: var(--primary-soft); }
.thd-nav:disabled { opacity: .3; cursor: default; }
.thd-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.thd-grid b { font-size: 12px; font-weight: 500; color: var(--muted); padding: 4px 0; }
.thd-grid button { height: 36px; border: 0; border-radius: 10px; background: transparent; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.thd-grid button:hover:not(:disabled) { background: var(--primary-soft); }
.thd-grid button.today { box-shadow: inset 0 0 0 1px var(--primary); }
.thd-grid button.on { background: var(--primary); color: #fff; font-weight: 600; }
.thd-grid button:disabled { color: var(--border-strong); cursor: default; }
.thd-foot { display: flex; justify-content: space-between; margin-top: 8px; }
.thd-foot button { border: 0; background: transparent; font: inherit; font-size: 13.5px; color: var(--primary-text); padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.thd-foot button:hover { background: var(--primary-soft); }

/* ═══════════════ บิลและรับเงิน ═══════════════ */
/* ── หน้าบิล ── */
.bill-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.bill-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.bill-head .grow { flex: 1; min-width: 200px; }
.bill-head h1 { margin: 0; font-size: 24px; }
.pet-group { margin-top: 14px; }
.pet-group:first-child { margin-top: 0; }
.pet-group-h { display: flex; align-items: center; gap: 10px; padding: 6px 0 8px; border-bottom: 1px solid var(--border); }
.pet-group-h .pet-photo { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
.pet-group-h b { flex: 1; }
.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.lines td { padding: 10px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.lines td.n { text-align: right; white-space: nowrap; }
.lines td:nth-child(2) { width: 90px; }
.lines td:nth-child(3) { width: 110px; }
.lines .disc { color: var(--ok); font-size: 12.5px; }
.lines .from { font-size: 12px; color: var(--muted); }
.lines tr:last-child td { border-bottom: 0; }
.add-line { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.add-line input { flex: 1; min-width: 200px; }
.sum-card { position: sticky; top: 64px; }
.sum-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14.5px; }
.sum-row.muted { color: var(--muted); }
.sum-row.disc { color: var(--ok); }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 6px; margin-top: 6px; border-top: 1px solid var(--border); }
.sum-total .v { font-size: 30px; font-weight: 600; letter-spacing: -.5px; }
.owe-banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: 14px; margin-bottom: 14px; }
.owe-banner .grow { flex: 1; }

/* ── รับเงิน ── */
.pay-wrap { max-width: 760px; margin: 0 auto; }
.pay-top { text-align: center; padding: 6px 0 14px; }
.pay-top .due { font-size: 40px; font-weight: 600; letter-spacing: -1px; }
.pay-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pay-tab { padding: 14px 10px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); font: inherit; color: var(--text); cursor: pointer; display: grid; justify-items: center; gap: 6px; }
.pay-tab.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.pay-tab .icon { width: 22px; height: 22px; }
.cash-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.change { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: var(--ok-soft); color: var(--ok); }
.change .v { font-size: 26px; font-weight: 600; }
.paid-list { margin-top: 14px; }
.paid-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.qr-pay { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: center; }
.qr-pay .qr-box { width: 200px; height: 200px; }
.left-row { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; font-size: 15px; }
.left-row .v { font-size: 22px; font-weight: 600; color: var(--warn); }

/* ── ใบเสร็จ ── */
.rc-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.rc-80 { position: static; width: 280px; }
.rc-a4 { background: #fff; color: #111; border-radius: 6px; border: 1px solid var(--border); box-shadow: var(--shadow); padding: 28px 30px; font-size: 12.5px; aspect-ratio: 1 / 1.414; overflow: hidden; }
.rc-a4 .top { display: flex; justify-content: space-between; gap: 16px; }
.rc-a4 h3 { margin: 0 0 4px; font-size: 16px; color: #111; }
.rc-a4 table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.rc-a4 th, .rc-a4 td { padding: 6px 4px; border-bottom: 1px solid #e5e5e5; text-align: left; }
.rc-a4 th { font-weight: 600; background: #f6f6f6; }
.rc-a4 .n { text-align: right; }
.rc-a4 .tot { display: flex; justify-content: flex-end; margin-top: 10px; }
.rc-a4 .tot div { min-width: 220px; }
.rc-a4 .tot .r { display: flex; justify-content: space-between; padding: 3px 0; }
.rc-a4 .grp td { background: #fafafa; font-weight: 600; }
.void-stamp { display: inline-block; padding: 2px 10px; border: 2px solid var(--danger); color: var(--danger); border-radius: 6px; font-weight: 700; transform: rotate(-6deg); }

/* ── บิลวันนี้ ── */
.bills { width: 100%; border-collapse: collapse; font-size: 14px; }
.bills th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.bills td { padding: 12px 8px; border-bottom: 1px solid var(--border); }
.bills td.n { text-align: right; white-space: nowrap; }
.bills tr.void td { color: var(--muted); text-decoration: line-through; }
.bills tr.void td:last-child { text-decoration: none; }

/* ── ปิดยอด ── */
.close-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ch-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.ch-row .l { display: flex; gap: 10px; align-items: center; }
.ch-row .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.ch-row .ic .icon { width: 18px; height: 18px; }
.ch-row.total { border-bottom: 0; font-weight: 600; font-size: 17px; }
.diff { margin-top: 14px; padding: 12px 14px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; }
.diff.bad { background: var(--danger-soft); color: var(--danger); }
.diff.ok { background: var(--ok-soft); color: var(--ok); }
.diff .v { font-size: 20px; font-weight: 600; }

@media (max-width: 1100px) {
  .bill-layout, .rc-layout, .close-grid { grid-template-columns: 1fr; }
  .sum-card { position: static; }
  .rc-80 { margin: 0 auto; }
}
@media (max-width: 720px) {
  .pay-tabs { grid-template-columns: repeat(2, 1fr); }
  .qr-pay { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .bills .hide-m { display: none; }
  .rc-a4 { aspect-ratio: auto; padding: 18px; }
}

/* ── เพิ่มเติมของหน้าจริง ── */
.lines tr[data-line] { cursor: pointer; }
.lines tr[data-line]:hover td { background: var(--primary-soft); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; color: var(--primary-text); text-decoration: underline; cursor: pointer; }
.change.bad { background: var(--danger-soft); color: var(--danger); }
.rlogo-a4 { position: relative; overflow: hidden; width: 44px; height: 44px; border-radius: 10px; margin-bottom: 8px; }
.rlogo-a4 img { width: 100%; height: 100%; object-fit: cover; }
.bills tr[data-bill] { cursor: pointer; }
.bills tr[data-bill]:hover td { background: var(--primary-soft); }
@media print {
  .sidebar, .topbar, .mesh, #cl-form .card-actions, #cl-date, .toast-stack { display: none !important; }
  .app, .main-col, main { display: block !important; padding: 0 !important; }
}
.card-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ═══════════════ รูปโปรไฟล์สัตว์ขนาดใหญ่ + ประวัติการรักษา ═══════════════ */
.pet-card { padding: 0; overflow: hidden; }
.pet-card .pet-cover { width: 100%; height: 190px; border-radius: 0; font-size: 56px; }
.pet-card .pet-cover img { transition: transform 500ms var(--ease-out); }
.pet-card:hover .pet-cover img { transform: scale(1.04); }
.pet-card-body { padding: 14px 18px 18px; }
.pet-card-body .alert-pill { margin-top: 8px; }
.pet-card-body .stats { margin-top: 12px; }
.add-pet-card { min-height: 220px; }
.pet-avatar-xl { position: relative; display: block; }
.pet-photo-xl { width: 168px; height: 168px; border-radius: 32px; font-size: 64px; box-shadow: var(--shadow); }
.pet-avatar-xl .cam { position: absolute; right: -4px; bottom: -4px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow); border: 1px solid var(--border); }
.pet-avatar-xl .cam .icon { width: 20px; height: 20px; }
@media (max-width: 720px) { .pet-photo-xl { width: 128px; height: 128px; border-radius: 26px; font-size: 48px; } .pet-card .pet-cover { height: 210px; } }

.hx-gallery { margin-bottom: 16px; }
.hx-gallery-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.hx-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.hx-thumb { flex: 0 0 auto; width: 120px; border: 0; padding: 0; background: none; cursor: pointer; text-align: left; font: inherit; scroll-snap-align: start; }
.hx-thumb img { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; display: block; border: 1px solid var(--border); transition: transform var(--dur) var(--ease-out); }
.hx-thumb:hover img { transform: translateY(-2px); }
.hx-thumb span { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.hx-list { display: grid; gap: 10px; }
.hx-card { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; }
.hx-head { width: 100%; display: flex; gap: 14px; align-items: center; padding: 12px 14px; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.hx-head:hover { background: var(--primary-soft); }
.hx-head .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.hx-date { width: 54px; flex-shrink: 0; text-align: center; padding: 6px 0; border-radius: 12px; background: var(--primary-soft); color: var(--primary-text); display: grid; line-height: 1.2; }
.hx-date span { font-size: 11.5px; }
.hx-chev { transition: transform var(--dur) ease; color: var(--muted); flex-shrink: 0; }
.hx-card.open .hx-chev { transform: rotate(180deg); }
.hx-body { display: none; padding: 4px 16px 16px 82px; }
.hx-card.open .hx-body { display: block; animation: fade-in 200ms ease; }
.hx-vitals { font-size: 13px; color: var(--text-soft); padding: 6px 10px; border-radius: 10px; background: var(--surface-2); display: inline-block; margin-bottom: 6px; }
.hx-block { margin-top: 10px; }
.hx-block > span { font-size: 12px; color: var(--muted); }
.hx-block p { margin: 2px 0 0; white-space: pre-wrap; }
.hx-items { margin: 4px 0 0; padding-left: 18px; }
.hx-items li { margin: 2px 0; }
.att { border: 0; padding: 0; background: none; cursor: pointer; }
.modal-wide { width: min(880px, calc(100vw - 32px)); max-width: none; }
.ph-view { display: grid; place-items: center; background: #0f1115; border-radius: 14px; overflow: hidden; }
.ph-view img { max-width: 100%; max-height: 66vh; object-fit: contain; display: block; }
.ph-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; }
@media (max-width: 720px) { .hx-body { padding-left: 16px; } }

/* ═══════════════ นัดหมาย ═══════════════ */
/* ── แถบเครื่องมือปฏิทิน ── */
.cal-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.cal-tools .date { font-size: 18px; font-weight: 600; min-width: 210px; text-align: center; white-space: nowrap; }
.cal-tools .sp { flex: 1; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ── มุมมองวัน (คอลัมน์ตามหมอ) ── */
.day-cal { --row: 44px; display: grid; grid-template-columns: 58px repeat(var(--cols), minmax(170px, 1fr)); overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.dc-head { position: sticky; top: 0; z-index: 2; padding: 10px; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); background: var(--surface); display: flex; gap: 8px; align-items: center; font-weight: 500; }
.dc-head .muted { font-weight: 400; font-size: 12px; }
.dc-corner { border-bottom: 1px solid var(--border); background: var(--surface); }
.dc-allday { grid-column: 1 / -1; display: grid; grid-template-columns: 58px repeat(var(--cols), minmax(170px, 1fr)); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.dc-allday > div { padding: 6px; border-left: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px; min-height: 36px; }
.dc-allday > div:first-child { border-left: 0; font-size: 11px; color: var(--muted); align-items: center; justify-content: center; text-align: center; line-height: 1.2; }
.chip-ap { font-size: 12px; padding: 3px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; }
.dc-times { position: relative; }
.dc-times div { height: var(--row); font-size: 11px; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.dc-col { position: relative; border-left: 1px solid var(--border); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--row) - 1px), var(--border) calc(var(--row) - 1px), var(--border) var(--row)); }
.dc-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--muted) 8%, transparent) 0 6px, transparent 6px 12px); pointer-events: none; }
.dc-off span { position: absolute; top: 6px; left: 8px; font-size: 11px; color: var(--muted); }
.dc-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 1; }
.dc-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.ap { position: absolute; left: 4px; right: 4px; border-radius: 10px; padding: 5px 8px; font-size: 12.5px; line-height: 1.3; overflow: hidden; cursor: pointer; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--text); transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) ease; }
.ap:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); z-index: 3; }
.ap b { display: block; font-weight: 600; }
.ap .t { color: var(--muted); font-size: 11.5px; }
.ap.short { display: flex; gap: 6px; align-items: baseline; padding: 4px 8px; white-space: nowrap; }
.ap.short b { display: inline; }
.ap .st { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--s); }
.ap.done { opacity: .55; }
.ap.noshow { opacity: .55; text-decoration: line-through; }
.empty-slot { position: absolute; left: 4px; right: 4px; border: 1.5px dashed var(--primary); border-radius: 10px; display: grid; place-items: center; color: var(--primary-text); font-size: 12.5px; background: var(--primary-soft); }

/* ── มุมมองสัปดาห์ / เดือน ── */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
.month .dh { padding: 8px; text-align: center; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.month .d { min-height: 104px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 12px; cursor: pointer; }
.month .d:nth-child(7n) { border-right: 0; }
.month .d.other { background: var(--surface-2); color: var(--muted); }
.month .d.today .n { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 7px; }
.month .d.holiday { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--muted) 7%, transparent) 0 6px, transparent 6px 12px); }
.month .n { display: inline-block; font-weight: 600; margin-bottom: 4px; }
.month .mini { display: block; padding: 2px 6px; border-radius: 6px; margin-top: 3px; background: color-mix(in srgb, var(--c) 16%, var(--surface)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month .more { color: var(--muted); margin-top: 3px; display: block; }

/* ── ฟอร์มนัด ── */
.ap-form { max-width: 720px; }
.pet-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.pet-pick label { display: flex; gap: 8px; align-items: center; margin: 0; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer; }
.pet-pick label.on { border-color: var(--primary); background: var(--primary-soft); }
.pet-pick .pet-photo { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.type-grid .type-card { border-left: 4px solid var(--c); }
.time-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.slots { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.slots button { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.slots button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.slots button:disabled { color: var(--border-strong); text-decoration: line-through; cursor: default; }

/* ── รายละเอียดนัด ── */
.ap-detail { max-width: 520px; }
.ap-detail .rowx { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.ap-detail .rowx span:first-child { width: 110px; color: var(--muted); flex-shrink: 0; }
.hist { font-size: 12.5px; color: var(--muted); margin-top: 10px; }

/* ── ตามลูกค้า ── */
.remind-row { display: flex; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.remind-row .tm { width: 64px; text-align: center; font-weight: 600; }
.remind-row .tm span { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.remind-row .grow { flex: 1; min-width: 200px; }
.seg-mini { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg-mini button { font: inherit; font-size: 12.5px; padding: 5px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.seg-mini button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 500; }

/* ── ตารางเวร ── */
.roster { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.roster th, .roster td { padding: 8px; border-bottom: 1px solid var(--border); text-align: center; }
.roster th:first-child, .roster td:first-child { text-align: left; }
.shift { display: inline-block; padding: 4px 8px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-text); font-size: 12.5px; white-space: nowrap; cursor: pointer; }
.shift.off { background: transparent; color: var(--muted); border: 1px dashed var(--border-strong); }
.shift.leave { background: var(--warn-soft); color: var(--warn); }

.month .dot-count { display: none; margin-left: 4px; color: var(--primary-text); font-weight: 600; }
@media (max-width: 720px) {
  .month .more { display: none; }
  .cal-tools .date { min-width: 0; flex: 1; font-size: 16px; }
  .month .d { min-height: 64px; }
  .month .mini { display: none; }
  .month .dot-count { display: inline-block; }
}

/* ── เพิ่มเติมของหน้าจริง ── */
.dc-head .avatar { width: 30px; height: 30px; font-size: 13px; flex-shrink: 0; }
.dc-col { cursor: copy; }
.ap.movable { cursor: grab; touch-action: none; }
.ap.dragging { cursor: grabbing; opacity: .85; box-shadow: var(--shadow); z-index: 5; transition: none; }
.chip-ap { font: inherit; font-size: 12px; color: var(--text); border-left: 3px solid var(--c); }
.chip-ap.arrived { opacity: .6; }
.chip-ap.no_show { opacity: .55; text-decoration: line-through; }
.legend .st-dot { border-radius: 50%; }
.slots button.taken { color: var(--muted); text-decoration: line-through; }
.slots button.taken.on { color: #fff; text-decoration: none; }
.picked-cust { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.picked-cust .grow { flex: 1; }
.warn-list { margin: 14px 0 0; padding-left: 20px; color: var(--warn); }
.warn-list li { margin: 4px 0; }
.week-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wk-day { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 8px; min-height: 160px; display: flex; flex-direction: column; gap: 6px; }
.wk-day.today { border-color: var(--primary); }
.wk-day.holiday { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--muted) 7%, transparent) 0 6px, var(--surface) 6px 12px); }
.wk-head { display: flex; justify-content: space-between; align-items: baseline; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; padding: 2px 4px; border-radius: 8px; }
.wk-head:hover { background: var(--primary-soft); }
.wk-head span { font-size: 18px; font-weight: 600; }
.wk-day.today .wk-head span { color: var(--primary-text); }
.wk-item { text-align: left; font: inherit; font-size: 12.5px; border: 0; border-left: 3px solid var(--c); border-radius: 8px; padding: 5px 7px; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--text); cursor: pointer; }
.wk-item span { display: block; color: var(--muted); font-size: 11.5px; }
.wk-item.arrived, .wk-item.no_show { opacity: .55; }
.month .d { cursor: pointer; }
.shift.free { background: transparent; color: var(--muted); font-size: 12px; }
.type-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 8px; vertical-align: -1px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px var(--surface); }
.swatches button.on { border-color: var(--text); }
#ap-jump + .thd-btn { padding: 7px 12px; font-size: 13.5px; }
@media (max-width: 900px) { .week-cal { grid-template-columns: 1fr; } .wk-day { min-height: 0; } }
@media (max-width: 720px) {
  .cal-tools #ap-label { order: -1; flex-basis: 100%; text-align: left; min-width: 0; }
  .cal-tools #ap-jump + .thd-btn { width: auto; }
}
.back-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px 6px 8px; border-radius: 999px; color: var(--text-soft); }
.back-btn:hover { background: var(--primary-soft); color: var(--primary-text); }
.back-btn .icon { width: 20px; height: 20px; }

/* ═══════════════ ยาและคลัง ═══════════════ */
/* ── คลังสินค้า ── */
.stock-list { width: 100%; border-collapse: collapse; font-size: 14px; }
.stock-list th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.stock-list td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.stock-list td.n, .stock-list th.n { text-align: right; white-space: nowrap; }
.stock-list tr:hover td { background: var(--primary-soft); cursor: pointer; }
.qty { font-weight: 600; font-size: 15px; }
.qty.low { color: var(--warn); }
.qty.neg { color: var(--danger); }
.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 4px; width: 90px; margin-left: auto; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.bar i.low { background: var(--warn); }
.bar i.neg { background: var(--danger); width: 100% !important; }
.exp { font-size: 12.5px; }
.exp.soon { color: var(--warn); font-weight: 500; }
.exp.over { color: var(--danger); font-weight: 500; }

/* ── รายละเอียดสินค้า ── */
.item-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.item-head .grow { flex: 1; min-width: 220px; }
.item-head h1 { margin: 0; }
.big-qty { text-align: right; }
.big-qty .v { font-size: 34px; font-weight: 600; letter-spacing: -.5px; line-height: 1; }
.two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lots, .moves { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.lots th, .moves th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--border); }
.lots td, .moves td { padding: 10px 6px; border-bottom: 1px solid var(--border); }
.lots td.n, .moves td.n, .lots th.n, .moves th.n { text-align: right; }
.lots tr.next td { background: var(--primary-soft); }
.mv-in { color: var(--ok); font-weight: 600; }
.mv-out { color: var(--text); font-weight: 600; }
.mv-adj { color: var(--warn); font-weight: 600; }

/* ── รับของเข้า ── */
.recv { width: 100%; border-collapse: collapse; font-size: 14px; }
.recv th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.recv td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.recv input, .recv select { padding: 8px 10px; }
.recv .conv { font-size: 12px; color: var(--muted); margin-top: 4px; }
.recv-total { display: flex; justify-content: flex-end; gap: 24px; padding: 14px 6px 0; font-size: 15px; }

/* ── ตรวจนับ ── */
.count { width: 100%; border-collapse: collapse; font-size: 14px; }
.count th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.count td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.count input { width: 100px; padding: 8px 10px; text-align: right; }
.count .diff-pos { color: var(--ok); font-weight: 600; }
.count .diff-neg { color: var(--danger); font-weight: 600; }

/* ── ฉลากยา ── */
.label-wrap { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.drug-label { width: 300px; background: #fff; color: #111; border-radius: 6px; border: 1px solid var(--border); box-shadow: var(--shadow); padding: 12px 14px; font-size: 12px; line-height: 1.45; }
.drug-label .hd { display: flex; justify-content: space-between; border-bottom: 1px solid #ddd; padding-bottom: 6px; margin-bottom: 6px; }
.drug-label .drug { font-size: 15px; font-weight: 700; margin: 4px 0; }
.drug-label .how { font-size: 14px; font-weight: 600; padding: 6px 8px; background: #f3f5f4; border-radius: 4px; margin: 6px 0; }
.drug-label .ft { display: flex; justify-content: space-between; color: #555; font-size: 11px; border-top: 1px solid #ddd; padding-top: 6px; margin-top: 6px; }

/* ── บาร์โค้ด ── */
.scan-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; border: 1.5px dashed var(--primary); background: var(--primary-soft); }
.scan-bar .grow { flex: 1; min-width: 200px; }
.scan-bar input { background: var(--surface); }
.ready { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ok); font-weight: 500; }
.ready::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.flash td { animation: flash 1.2s ease; }
@keyframes flash { from { background: color-mix(in srgb, var(--ok) 25%, transparent); } to { background: transparent; } }
.phone { width: 280px; border-radius: 34px; background: #0f1115; padding: 14px; box-shadow: var(--shadow-lg); }
.phone .screen { position: relative; border-radius: 22px; overflow: hidden; height: 470px; background: linear-gradient(160deg, #3a3f47, #1d2025); }
.phone .frame { position: absolute; left: 50%; top: 42%; width: 210px; height: 120px; transform: translate(-50%, -50%); border: 3px solid #fff; border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.45); }
.phone .laser { position: absolute; left: 10px; right: 10px; top: 50%; height: 2px; background: #ff5a5a; box-shadow: 0 0 10px #ff5a5a; animation: laser 1.6s infinite ease-in-out; }
@keyframes laser { 0%, 100% { top: 20%; } 50% { top: 80%; } }
.phone .code { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); display: flex; gap: 2px; height: 70px; }
.phone .code i { display: block; width: 3px; background: #fff; }
.phone .code i:nth-child(3n) { width: 1px; } .phone .code i:nth-child(4n) { width: 5px; }
.phone .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px; background: #fff; color: #111; font-size: 13px; }
.phone .cap b { display: block; font-size: 15px; }
.steps { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.step { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.step b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.step.on { color: var(--text); } .step.on b { background: var(--primary); color: #fff; }
.step.done b { background: var(--ok-soft); color: var(--ok); }
.imp { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.imp th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.imp td { padding: 9px 6px; border-bottom: 1px solid var(--border); }
.imp tr.err td { background: var(--danger-soft); }
.imp tr.err .why { color: var(--danger); font-size: 12px; }
.imp tr.new td:first-child::after { content: 'ใหม่'; margin-left: 6px; font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.bc-list .version-row code { font-size: 13px; background: var(--surface-2); padding: 2px 8px; border-radius: 6px; }
.sticker { width: 190px; padding: 8px 10px; background: #fff; color: #111; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; text-align: center; box-shadow: var(--shadow-sm); }
.sticker .bars { display: flex; gap: 1px; justify-content: center; height: 40px; margin: 4px 0; }
.sticker .bars i { display: block; width: 2px; background: #111; } .sticker .bars i:nth-child(3n) { width: 1px; } .sticker .bars i:nth-child(5n) { width: 3px; }
@media (max-width: 900px) { .two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .stock-list .hide-m, .recv .hide-m, .count .hide-m, .lots .hide-m, .moves .hide-m { display: none; }
  .bar { margin-left: 0; }
}

/* ── เพิ่มเติมของหน้าจริง ── */
.cam-view { position: relative; margin-top: 14px; border-radius: 16px; overflow: hidden; background: #111; aspect-ratio: 4 / 3; }
.cam-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame { position: absolute; left: 50%; top: 50%; width: 72%; height: 38%; transform: translate(-50%, -50%); border: 3px solid #fff; border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .4); }
.cam-laser { position: absolute; left: 16%; right: 16%; top: 50%; height: 2px; background: #ff5a5a; box-shadow: 0 0 10px #ff5a5a; animation: laser 1.6s infinite ease-in-out; }
.cam-cap { margin-top: 10px; text-align: center; font-size: 14px; }
.file-drop { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 28px; margin: 0; border: 2px dashed var(--border-strong); border-radius: 16px; cursor: pointer; color: var(--muted); font-size: 15px; }
.file-drop:hover { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }
.result.picked { background: var(--primary-soft); }
.stock-list tr[data-item] { cursor: pointer; }
.pick-list button .muted { white-space: nowrap; }
@media (max-width: 720px) { .scan-bar .ready { display: none; } }
.bad-text { color: var(--danger); font-weight: 500; }
.recv td:first-child { min-width: 150px; }
.recv .thd-btn { min-width: 140px; padding: 8px 10px; }

/* ─── จอคิว (ฟีเจอร์ 7): แถบเรียกคิว · เลือกห้อง · บัตรคิว ─── */
.calling { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-size: 14px; margin: 0 0 12px; }
.calling .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: callPulse 1.2s infinite; }
@keyframes callPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.room-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.room-pick button { font: inherit; padding: 14px; min-height: 44px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.room-pick button:hover { border-color: var(--primary); }
.room-pick button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.room-pick button small { display: block; color: var(--muted); font-size: 12px; }
.ticket-wrap { display: flex; justify-content: center; margin-top: 14px; }
.ticket { width: 260px; background: #fff; color: #111; border-radius: 8px; padding: 16px 14px; font-size: 12px; text-align: center; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.ticket hr { border: 0; border-top: 1px dashed #bbb; margin: 8px 0; }
.ticket .tno { font-size: 64px; font-weight: 700; line-height: 1.05; margin: 4px 0; }
.ticket .tmuted { color: #666; }
.ticket .tsmall { font-size: 11px; }
.ticket .tqr svg { width: 120px; height: 120px; display: block; margin: 4px auto; }
.qr-big { background: #fff; color: #111; border-radius: 16px; padding: 18px; text-align: center; max-width: 340px; }
.qr-big svg { width: min(280px, 70vw); height: auto; display: block; margin: 0 auto; }
.qr-big p { margin: 10px 0 0; font-size: 14px; }
@media (max-width: 520px) { .room-pick { grid-template-columns: minmax(0, 1fr); } }

/* ── แถบช่วงทดลองใช้ / บัญชีทดลอง (ใต้แถบบน) ── */
.plan-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 30px 0; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; animation: fade-up 260ms var(--ease-out); }
.plan-bar[hidden] { display: none; }
.plan-bar > span { flex: 1; min-width: 200px; }
.plan-bar .icon { flex: none; }
.plan-trial { background: var(--primary-soft); color: var(--primary-text); }
.plan-warn { background: var(--warn-soft); color: var(--warn); }
.plan-demo { background: var(--accent-soft); color: var(--accent); }
.plan-demo .btn { margin-left: auto; background: color-mix(in srgb, var(--surface) 75%, transparent); border-color: transparent; color: var(--accent); }
@media (max-width: 768px) { .plan-bar { margin: 12px 16px 0; } .plan-demo .btn { width: 100%; } }

/* ── ตัวช่วยสั่งยา (rx.js) ── */
.rx-box { margin-top: 10px; }
.rx-row { display: grid; grid-template-columns: 82px 1fr; gap: 8px; align-items: start; margin-top: 8px; }
.rx-k { font-size: 13px; font-weight: 600; color: var(--text-soft); padding-top: 6px; }
.rx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rx-chip { font: inherit; font-size: 13.5px; padding: 5px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); cursor: pointer; transition: background var(--dur), border-color var(--dur), color var(--dur); }
.rx-chip:hover { border-color: var(--border-strong); }
.rx-chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); font-weight: 500; }
.rx-chip.on[data-g="warn"], #ie-warn .rx-chip.on { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 50%, transparent); color: var(--warn); }
.rx-other { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.rx-other input { width: 70px; padding: 5px 8px; }
.rx-out { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.rx-out textarea { font-weight: 500; }
.rx-qty { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; }
.rx-qty input { width: 90px; display: inline-block; }
.rx-warn-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rx-warn-tags span { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
@media (max-width: 600px) { .rx-row { grid-template-columns: 1fr; gap: 4px; } .rx-k { padding-top: 0; } }

/* ── หน้าต่างพิมพ์ฉลากยา ── */
.lbl-sizes { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.lbl-list { display: grid; gap: 6px; max-height: 210px; overflow: auto; }
.lbl-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; }
.lbl-item .check { margin: 0; align-items: flex-start; }
.lbl-copies { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.lbl-copies b { min-width: 18px; text-align: center; }
.lbl-stage { margin-top: 12px; border-radius: 14px; padding: 18px; display: grid; place-items: center; background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 8px, var(--bg) 8px, var(--bg) 16px); }
.lbl-paper { background: #fff; color: #111; border-radius: 3px; box-shadow: 0 6px 18px rgba(16,24,40,.15); font-family: Prompt, sans-serif; }
.lbl-paper.p50x30 { width: 230px; height: 138px; padding: 6px 8px; font-size: 9px; overflow: hidden; }
.lbl-paper.p60x40 { width: 260px; height: 173px; padding: 8px 10px; font-size: 10px; overflow: hidden; }
.lbl-paper.p80mm { width: 300px; padding: 10px 12px; font-size: 11.5px; }
.lbl-paper .lb { line-height: 1.32; }
.lbl-paper .hd, .lbl-paper .who, .lbl-paper .ft { display: flex; justify-content: space-between; gap: 4px; }
.lbl-paper .hd { border-bottom: 1px solid #999; padding-bottom: 2px; margin-bottom: 2px; }
.lbl-paper .drug { font-weight: 700; font-size: 1.22em; margin: 2px 0; }
.lbl-paper .how { font-weight: 600; font-size: 1.12em; background: #eee; border-radius: 3px; padding: 2px 4px; margin: 2px 0; }
.lbl-paper .warn { display: flex; flex-wrap: wrap; gap: 3px; margin: 2px 0; }
.lbl-paper .warn span { border: 1px solid #111; border-radius: 3px; padding: 0 4px; font-weight: 600; font-size: .92em; }
.lbl-paper .ft { color: #444; border-top: 1px solid #999; padding-top: 2px; margin-top: 2px; font-size: .9em; }

/* ── ระบบที่คลินิกปิดไว้ (body.mod-off-*) ── */
body.mod-off-queue .qno, body.mod-off-queue .next-q { display: none !important; }
body.mod-off-queue [data-recall], body.mod-off-tv.mod-off-customerApp [data-recall] { display: none !important; }
body.mod-off-screening [data-screen-card], body.mod-off-screening [data-vscreen] { display: none !important; }
body.mod-off-customerApp #c-app { display: none !important; }
body.mod-off-grooming #oq-type, body.mod-off-grooming #oq-type-label { display: none !important; }
body.mod-off-appointments #c-appt { display: none !important; }

/* ── หน้าตั้งค่า: ระบบที่ใช้งาน ── */
.type-cards.three { grid-template-columns: repeat(3, 1fr); margin-top: 8px; }
.mod-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; }
.mod-flow b { margin-right: 4px; }
.mod-flow span { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px 10px; }
.mod-flow .icon { color: var(--muted); transform: rotate(-90deg); }
.mod-h { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }
.mod-h:first-child { margin-top: 0; }
.mod-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.mod-h + .mod-row { border-top: 0; }
.mod-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.mod-t { flex: 1; min-width: 0; }
.mod-t b { display: block; }
.mod-t > span { color: var(--text-soft); font-size: 13.5px; }
.mod-t em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.mod-t .seg { margin-top: 8px; flex-wrap: wrap; }
.mod-row.locked { opacity: .85; }
.mod-row .switch { margin-top: 6px; flex: none; }
@media (max-width: 768px) { .type-cards.three { grid-template-columns: 1fr; } }

/* ใบรับรอง */
.cert-list { display: grid; gap: 8px; margin-bottom: 10px; }
.cert-row { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.cert-row.void { opacity: .6; }
.cert-row .grow { flex: 1; min-width: 0; }
.cf-find { display: grid; gap: 6px; flex: 1; }
.cf-find .check { margin: 0; }
.cert-signer { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 14px; color: var(--text-soft); }
.sig-now { min-height: 64px; display: flex; align-items: center; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); }
.sig-now img { max-height: 70px; max-width: 100%; background: #fff; border-radius: 8px; }
.sig-pad { width: 100%; max-width: 420px; aspect-ratio: 3 / 1; height: auto; display: block; background: #fff; border: 1.5px dashed var(--border-strong); border-radius: 14px; touch-action: none; cursor: crosshair; }

/* ─── ประวัติเก่า (กระดาษ / คลินิกอื่น / นำเข้า) ─── */
.hx-bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.hx-card.past { background: var(--surface-2); border-style: dashed; }
.hx-card.past .hx-date { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.att-pdf { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; background: var(--surface); }
.att-pdf .icon { width: 22px; height: 22px; }

/* ─── ปฏิทินนัด: ตัวย่อหมอ · รายวันแบบรายการ · ช่วงว่างที่ย่อไว้ ─── */
.ap-vet { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text); white-space: nowrap; }
.ap-vet i { font-style: normal; width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; flex: none;
  color: var(--v, var(--muted)); background: color-mix(in srgb, var(--v, var(--muted)) 16%, var(--surface)); }
.ap-vet.none i { --v: var(--muted); }
.dc-head .ap-vet i { width: 30px; height: 30px; font-size: 13px; }
.vet-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; }
.month .mini { display: flex; align-items: center; gap: 4px; }
.month .mini .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.month .mini .ap-vet i { width: 16px; height: 16px; font-size: 10px; background: var(--surface); }
.wk-item .ap-vet { margin-right: 4px; vertical-align: middle; }
.wk-item .ap-vet i { width: 16px; height: 16px; font-size: 10px; }
.ap .o { display: block; }
.dc-times .gap { height: var(--row); }
.dc-gap { position: absolute; left: 0; right: 0; z-index: 1; border: 0; border-top: 1px dashed var(--border-strong); border-bottom: 1px dashed var(--border-strong); font: inherit; font-size: 12px; color: var(--muted); cursor: zoom-in;
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); text-align: left; padding: 0 10px; white-space: nowrap; }
.dc-gap:hover { color: var(--primary-text); }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: var(--primary-text); text-decoration: underline; cursor: pointer; }

.apl-sum { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.apl-sum div { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px 16px; font-size: 13px; color: var(--muted); }
.apl-sum b { display: block; font-size: 22px; color: var(--text); font-weight: 600; line-height: 1.3; }
.apl-hour { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; margin-bottom: 6px; }
.apl-hour > .h { font-size: 13px; color: var(--muted); text-align: right; padding-top: 14px; }
.apl { display: grid; grid-template-columns: 5px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 10px 14px 10px 0; margin-bottom: 6px; cursor: pointer; transition: box-shadow var(--dur) ease, transform var(--dur) var(--ease-out); }
.apl:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.apl .apl-c { align-self: stretch; grid-row: 1 / -1; border-radius: 0 6px 6px 0; background: var(--c); }
.apl .ttl b { font-weight: 600; }
.apl .who { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin-top: 3px; align-items: center; }
.apl .who .ap-vet { color: var(--muted); }
.apl .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.apl.done { opacity: .6; }
.apl.noshow .ttl b { text-decoration: line-through; }
.apl-gap { width: 100%; text-align: left; font: inherit; font-size: 13px; color: var(--muted); background: none; border: 1px dashed var(--border); border-radius: 12px; padding: 10px 14px; cursor: pointer; }
.apl-gap:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }
.apl-gap:disabled { cursor: default; border-style: dotted; }
.apl-now { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px 86px; font-size: 12.5px; font-weight: 600; color: var(--danger); }
.apl-now::after { content: ''; flex: 1; height: 2px; border-radius: 2px; background: var(--danger); }
@media (max-width: 720px) {
  .apl-hour { grid-template-columns: 46px minmax(0, 1fr); gap: 8px; }
  .apl-hour > .h { font-size: 12px; }
  .apl { grid-template-columns: 5px minmax(0, 1fr); }
  .apl .acts { grid-column: 2; justify-content: flex-start; }
  .apl-now { margin-left: 54px; }
  .apl-sum div { flex: 1 1 40%; }
}

/* หน้าเข้าสู่ระบบแบบมีแค่กล่องเข้าสู่ระบบกลางจอ */
.auth-shell.solo { grid-template-columns: 1fr; }
.auth-shell.solo .auth-mobile-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 24px; }
.auth-shell.solo .auth-main { padding-top: 72px; max-width: none; width: 100%; }

/* คำขอจากแอปลูกค้า */
.ap-head-act { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
#ap-req .badge { margin-left: 6px; }
#req-badge { margin-left: 4px; }
.rq-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); flex-wrap: wrap; }
.rq-card .grow { flex: 1; min-width: 220px; }
.rq-card .grow > b { font-size: 15.5px; }
.rq-card .grow > .small, .rq-card .grow > .muted { margin-top: 2px; }
.rq-card .badge { margin-top: 4px; }
.rq-act { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.rq-lines { display: grid; gap: 2px; margin-top: 6px; }
.rq-lines .muted { margin-right: 4px; }
.rq-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.rq-form > div { min-width: 150px; }
.rq-form label { margin: 0 0 4px; }
.rq-form select, .rq-form input[type=time] { width: auto; min-width: 150px; }
.rq-form .chk { display: inline-flex; gap: 6px; align-items: center; margin: 0 0 10px; width: auto; white-space: nowrap; font-weight: 400; }
.rq-form .chk input { width: auto; margin: 0; }
.btn.rq-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.btn.rq-no { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.set-row { display: flex; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.set-row:last-of-type { border-bottom: 0; }
.set-row .grow { flex: 1; min-width: 0; }

/* เข้าแอปหมอด้วย QR */
.app-qr-card .card-head { align-items: center; flex-wrap: wrap; }
.app-qr { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.app-qr .qr-big { width: 200px; margin: 0; flex: none; transition: opacity var(--dur) ease; }
.app-qr .qr-big svg { width: 100%; height: auto; display: block; }
.app-qr ol { flex: 1; min-width: 200px; margin: 0; padding-left: 20px; line-height: 1.8; }

/* คัดกรองวันนี้บนบัตรคิว (หลังกด "มาแล้ว") */
.tk-weigh { background: var(--surface-2, var(--primary-soft)); border-radius: 12px; padding: 4px 12px; margin: 12px 0 4px; }
.tk-w-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 0; }
.tk-w-row + .tk-w-row { border-top: 1px solid var(--border); }

/* คัดกรองตอนรับเคส: น้ำหนัก ไข้ ชีพจร หายใจ (ไม่บังคับ) */
.pick-pet { flex-wrap: wrap; }
.pick-pet .vit { display: none; width: 100%; padding-left: 32px; }
.pick-pet.on .vit { display: grid; }
.vit { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.vit-f { display: flex; flex-direction: column; gap: 3px; }
.vit-f span { font-size: 12px; color: var(--muted); }
.vit-f input { padding: 7px 9px; margin: 0; min-width: 0; }
.tk-w-row { display: block; }
.tk-weigh .vit { display: grid; }
.tk-w-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
@media (max-width: 480px) { .vit { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pick-pet .vit { padding-left: 0; } }
