/* ==========================================================================
   HAPPY PAWS — Design System (Mobile First)
   ========================================================================== */

:root {
  --brand: #1a1a1a;
  --brand-dark: #000000;
  --brand-light: #f0f0f0;
  --accent: #4a4a4a;
  --accent-light: #ececec;
  --bg: #f6f6f5;
  --surface: #ffffff;
  --text: #1c1c1c;
  --text-muted: #767676;
  --border: #e2e2e0;
  --success: #2f9e5c;
  --success-light: #e7f6ec;
  --warning: #d99a1f;
  --warning-light: #fdf3de;
  --danger: #d64545;
  --danger-light: #fbe9e9;
  --info: #3b82c4;
  --info-light: #e8f2fb;
  --pop-blue: #8ecdf7;
  --pop-blue-glow: rgba(142, 205, 247, 0.55);
  --pop-yellow: #ffd76a;
  --pop-yellow-glow: rgba(255, 215, 106, 0.6);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 2px 10px rgba(20, 20, 20, 0.06);
  --shadow-lift: 0 8px 24px rgba(20, 20, 20, 0.12);
  --nav-h: 68px;
  --header-h: 96px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Thai", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; display: block; }
svg { width: 22px; height: 22px; flex-shrink: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 8px; }

/* ---------- Layout shell ---------- */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-header__brand img { height: 80px; width: auto; }

.app-header__wordmark {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--brand-dark);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__actions { display: flex; align-items: center; gap: 8px; }

/* ---------- แจ้งเตือน (กระดิ่ง แบบเฟสบุ๊ค) ---------- */

.notif-bell-wrap { position: relative; }

.notif-bell-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.notif-bell-btn:hover { background: var(--pop-blue-glow); border-color: var(--pop-blue); }
.notif-bell-btn:active { box-shadow: inset 0 2px 0 0 var(--pop-yellow); }
.notif-bell-btn svg { width: 20px; height: 20px; }

.notif-bell-btn.notif-shake svg { animation: notif-shake 0.6s ease; }
@keyframes notif-shake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-16deg); }
  30% { transform: rotate(13deg); }
  45% { transform: rotate(-10deg); }
  60% { transform: rotate(7deg); }
  75% { transform: rotate(-4deg); }
}

.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(340px, 88vw);
  max-height: 420px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  z-index: 60;
}

.notif-panel__header {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
}
.notif-mark-all {
  border: none; background: none; cursor: pointer;
  color: var(--info); font-weight: 600; font-size: 0.82rem;
  padding: 4px 6px; border-radius: var(--radius-sm);
}
.notif-mark-all:hover { background: var(--info-light); }

.notif-panel__list { padding: 4px; }

.notif-item {
  display: block;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}
.notif-item:hover { background: var(--pop-blue-glow); }
.notif-item + .notif-item { margin-top: 2px; }
.notif-item.unread { background: var(--warning-light); }
.notif-item.unread:hover { background: var(--pop-yellow-glow); }
.notif-item__msg { font-size: 0.88rem; color: var(--text); margin-bottom: 2px; }
.notif-item__time { font-size: 0.72rem; color: var(--text-muted); }

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 24px);
}

/* ---------- Bottom navigation (mobile) ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(20, 20, 20, 0.06);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 2px;
  transition: box-shadow 0.15s ease;
}
.bottom-nav__item:active { box-shadow: inset 0 3px 0 0 var(--pop-yellow); }

.bottom-nav__item svg { width: 24px; height: 24px; }
.bottom-nav__item.active { color: var(--brand); }
.bottom-nav__item.active svg { stroke: var(--brand); }

/* ---------- Sidebar (desktop) ---------- */

.desktop-sidebar { display: none; }

@media (min-width: 900px) {
  .app-shell { flex-direction: row; }
  .bottom-nav { display: none; }
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    width: 232px;
    min-height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .desktop-sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; }
  .desktop-sidebar__brand img { height: 80px; }
  .desktop-sidebar__brand span { font-weight: 800; color: var(--brand-dark); font-size: 1.1rem; }
  .desktop-sidebar__link {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px; border-radius: var(--radius-sm);
    color: var(--text); font-weight: 600; font-size: 0.92rem;
    transition: box-shadow 0.18s ease, background 0.15s ease;
  }
  .desktop-sidebar__link svg { width: 20px; height: 20px; flex-shrink: 0; }
  .desktop-sidebar__link.active { background: var(--brand-light); color: var(--brand-dark); }
  .desktop-sidebar__link:hover { background: var(--bg); box-shadow: inset 3px 0 0 0 var(--pop-blue); }
  .desktop-sidebar__link:active { box-shadow: inset 3px 0 0 0 var(--pop-yellow); }
  .app-main-wrap { flex: 1; min-width: 0; }
  .app-main { padding: 24px 32px 40px; max-width: 1100px; }
  .app-header { display: none; }
  .desktop-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 32px; border-bottom: 1px solid var(--border); background: var(--surface);
  }
}

@media (max-width: 899px) {
  .desktop-topbar { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease, box-shadow 0.18s ease;
  text-align: center;
  line-height: 1.2;
  box-shadow: 0 0 0 0 transparent;
}
/* ลูกเล่นสีตอน hover/กด: ฟ้าอ่อนตอนชี้ (hover), เหลืองตอนกด (active) — ธีมหลักยังขาว-ดำเหมือนเดิม */
.btn:not(:disabled):hover { box-shadow: 0 0 0 4px var(--pop-blue-glow); }
.btn:not(:disabled):active { transform: scale(0.97); box-shadow: 0 0 0 4px var(--pop-yellow-glow); }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:not(:disabled):hover { border-color: var(--pop-blue); }
.btn-outline { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-ghost { background: transparent; color: var(--text-muted); min-height: 44px; border: 1.5px solid var(--border); }
.btn-ghost-danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); min-height: 44px; }
.btn-ghost-danger:not(:disabled):hover { background: var(--danger-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 0.88rem; border-radius: var(--radius-sm); }
.btn-lg { min-height: 58px; font-size: 1.08rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 420px) {
  .btn-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.card-title { font-weight: 700; font-size: 1rem; margin-bottom: 10px; }
.card-link { display: block; }
.card-link:active { transform: scale(0.99); }

/* แถว 2 คอลัมน์ (เช่น บันทึกก่อน/หลังบริการ อยู่แถวเดียวกันบนจอกว้าง เพื่อให้หน้าสั้นลง) */
.two-col-row { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
.two-col-row .card + .card { margin-top: 0; }
@media (min-width: 700px) {
  .two-col-row { grid-template-columns: 1fr 1fr; }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(5, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.stat-card__label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.stat-card__value { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.stat-card--brand .stat-card__value { color: var(--brand-dark); }
.stat-card--accent .stat-card__value { color: var(--accent); }

/* ---------- Forms ---------- */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text);
}
.field .hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* เตือนเบอร์ซ้ำ (หน้าจองคิว "ลูกค้าใหม่") — กรอบแดง + ข้อความเตือนใต้ช่อง */
input.input-error { border-color: var(--danger) !important; background: var(--danger-light); }
input.input-error:focus { box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.18); }
.phone-exists-hint {
  font-size: 0.82rem;
  color: var(--danger);
  margin: 6px 0 0;
  line-height: 1.4;
}
.phone-exists-hint a { text-decoration: underline; font-weight: 700; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

input[type="text"], input[type="tel"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="search"], input[type="file"],
select, textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 1rem;
  color: var(--text);
  font-family: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.checkbox-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.checkbox-row input[type="checkbox"] { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; accent-color: var(--brand); }
.checkbox-row label { font-weight: 500; font-size: 0.95rem; }

.radio-pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin:0; }
.radio-pill span {
  display: block; padding: 12px 16px; border-radius: var(--radius);
  border: 1.5px solid var(--border); font-weight: 600; background: var(--surface); text-align:center;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}
.radio-pill input:checked + span { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }
.radio-pill input:disabled + span { opacity: 0.4; text-decoration: line-through; }
.radio-pill input:not(:disabled):hover + span { box-shadow: 0 0 0 3px var(--pop-blue-glow); }
.radio-pill input:not(:disabled):active + span { box-shadow: 0 0 0 3px var(--pop-yellow-glow); }

/* Time slot grid */
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 480px) { .slot-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 700px) { .slot-grid { grid-template-columns: repeat(5, 1fr); } }

/* ---------- Badges / Status ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700;
  white-space: nowrap;
}
.badge-gray { background: #f0ede9; color: #6b6560; }
.badge-blue { background: var(--info-light); color: var(--info); }
.badge-cyan { background: #e3f6f8; color: #1a8fa0; }
.badge-amber { background: var(--warning-light); color: var(--warning); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-teal { background: var(--accent-light); color: var(--accent); }
.badge-red { background: var(--danger-light); color: var(--danger); }

/* ---------- Lists / Table-as-cards ---------- */

.list { display: flex; flex-direction: column; gap: 10px; }

.row-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}
.row-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.row-card__title { font-weight: 700; font-size: 1rem; }
.row-card__sub { color: var(--text-muted); font-size: 0.85rem; }
.row-card__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.85rem; color: var(--text-muted); }
.row-card__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Real table only used on wide screens inside .table-wrap */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg); font-weight: 700; color: var(--text-muted); font-size: 0.8rem; }
tr:last-child td { border-bottom: none; }

/* ---------- Toast / Flash ---------- */

.flash-stack {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px);
}
.flash {
  padding: 13px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.92rem;
  box-shadow: var(--shadow-lift); animation: slideDown 0.2s ease;
}
.flash-success { background: var(--success); color: #fff; }
.flash-error { background: var(--danger); color: #fff; }
.flash-warning { background: var(--warning); color: #fff; }
@keyframes slideDown { from { opacity:0; transform: translateY(-10px);} to {opacity:1; transform:translateY(0);} }

/* ---------- Empty state ---------- */

.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty-state svg { width: 56px; height: 56px; margin: 0 auto 12px; opacity: 0.4; }

/* ---------- Misc utility ---------- */

.section { margin-bottom: 24px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.mt-0{margin-top:0} .mb-0{margin-bottom:0}
.mt-1{margin-top:8px} .mb-1{margin-bottom:8px}
.mt-2{margin-top:16px} .mb-2{margin-bottom:16px}
.mt-3{margin-top:24px} .mb-3{margin-bottom:24px}
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; border:none; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  background: var(--brand-light); display:flex; align-items:center; justify-content:center;
  font-weight: 700; color: var(--brand-dark); flex-shrink:0; overflow:hidden;
}
.pet-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.money { font-variant-numeric: tabular-nums; }

.fab-actions { display: flex; flex-direction: column; gap: 10px; }

a.link { color: var(--brand-dark); font-weight: 700; text-decoration: underline; }

.chip-select { display:flex; flex-wrap:wrap; gap:8px; }
.chip {
  padding: 9px 14px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface); font-weight: 600; font-size: 0.9rem; cursor:pointer;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.05s ease;
}
.chip.selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip:hover { box-shadow: 0 0 0 3px var(--pop-blue-glow); }
.chip:active { transform: scale(0.96); box-shadow: 0 0 0 3px var(--pop-yellow-glow); }

.step-indicator { display:flex; gap:6px; margin-bottom:18px; }
.step-indicator span { flex:1; height:5px; border-radius:3px; background: var(--border); }
.step-indicator span.active { background: var(--brand); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(38,34,32,0.5); z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { .modal-overlay { align-items: center; } }
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 22px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lift);
}
@media (min-width: 640px) { .modal-box { border-radius: var(--radius-lg); } }

.disclaimer { font-size: 0.76rem; color: var(--text-muted); background: var(--bg); padding: 10px 12px; border-radius: var(--radius-sm); }

/* ---------- Public booking page (ไม่ต้อง Login) ---------- */

.public-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 16px; display: flex; align-items: center; justify-content: center;
}
.public-wrap { min-height: 100vh; padding-bottom: 40px; }
.public-main { max-width: 560px; margin: 0 auto; padding: 20px 16px; }
.public-intro { text-align: center; margin-bottom: 18px; }
.public-intro h1 { margin-bottom: 4px; }
.public-footer {
  max-width: 560px; margin: 24px auto 0; padding: 16px; text-align: center;
  color: var(--text-muted); font-size: 0.82rem; line-height: 1.8;
}
.hp-field { position: absolute; left: -9999px; top: -9999px; }
.mode-toggle { display: flex; gap: 10px; margin-bottom: 16px; }
.mode-toggle label { flex: 1; }
.mode-toggle input { display: none; }
.mode-toggle span {
  display: block; text-align: center; padding: 12px; border-radius: var(--radius);
  border: 1.5px solid var(--border); font-weight: 700; background: var(--surface);
}
.mode-toggle input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.lookup-result {
  background: var(--success-light); color: var(--success); border-radius: var(--radius-sm);
  padding: 10px 12px; font-weight: 600; font-size: 0.88rem; margin-top: 8px;
}
.lookup-result.not-found { background: var(--warning-light); color: var(--warning); }

.login-wrap {
  min-height: 100vh; display:flex; align-items:center; justify-content:center; padding: 24px;
  background: linear-gradient(160deg, var(--brand-light) 0%, var(--bg) 55%);
}
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--radius-lg); padding: 32px 26px; box-shadow: var(--shadow-lift); }
.login-logo { text-align:center; margin-bottom: 22px; }
.login-logo img { height: 128px; margin: 0 auto 10px; }
.login-logo .wordmark { font-size: 1.5rem; font-weight: 900; color: var(--brand-dark); letter-spacing: 0.03em; }
.login-logo .tagline { color: var(--text-muted); font-size: 0.85rem; font-weight: 600; margin-top: 2px; }
.demo-box { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 0.82rem; margin-top: 18px; }
.demo-box code { background: var(--surface); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); }

/* ---------- Print ---------- */

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .app-main { padding: 0; max-width: none; }
  .print-doc { box-shadow: none; border: none; padding: 0; }
  @page { size: A4; margin: 14mm; }
}

.print-doc { max-width: 720px; margin: 0 auto; background: #fff; padding: 28px; border-radius: var(--radius); border: 1px solid var(--border); }
.print-doc__header { display:flex; align-items:center; gap:14px; border-bottom: 2px solid var(--brand); padding-bottom: 16px; margin-bottom: 18px; }
.print-doc__header img { height: 80px; }
.print-doc__title { font-weight: 900; font-size: 1.1rem; color: var(--brand-dark); }
.print-doc__subtitle { font-size: 0.8rem; color: var(--text-muted); letter-spacing: 0.08em; }
.print-doc__meta { margin-left: auto; text-align: right; font-size: 0.82rem; color: var(--text-muted); }
.print-doc h3 { border-left: 4px solid var(--brand); padding-left: 8px; margin-top: 20px; }
.print-doc__totals { margin-top: 12px; padding-top: 12px; border-top: 1.5px dashed var(--border); }
.print-doc__totals .line { display:flex; justify-content:space-between; padding: 4px 0; }
.print-doc__totals .grand { font-weight: 800; font-size: 1.15rem; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.print-doc__footer { text-align:center; margin-top: 26px; color: var(--text-muted); font-size: 0.85rem; }

.doc-action-bar {
  position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border);
  padding: 12px 16px; display:flex; gap: 10px; margin: 24px -16px -24px;
}
@media (min-width: 900px) { .doc-action-bar { margin: 24px 0 0; border-radius: var(--radius); border: 1px solid var(--border); } }

/* ---------- อุ้งตีนหมาลอย (ambient background) ---------- */
/* หมายเหตุ: ต้องใช้ z-index เป็นบวก (ไม่ใช่ค่าลบ) ไม่งั้น .app-shell/.public-wrap ที่เป็น
   flex container จะทับอยู่ด้านหน้าเสมอ แม้จะไม่มีพื้นหลังทึบก็ตาม (เคยลองแล้วไม่เห็นอุ้งเท้าเลย) */
.paw-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

.paw-bg .paw {
  position: absolute;
  bottom: -10vh;
  width: var(--paw-size, 28px);
  height: auto;
  display: block;
  opacity: 0;
  animation: paw-float linear infinite;
}

/* ลอยขึ้นแบบ "กลิ้ง/วน" — โยกซ้ายขวาสลับกันไปพร้อมหมุนตัวไปเรื่อยๆ ระหว่างลอยขึ้น */
@keyframes paw-float {
  0%   { transform: translateY(0)      translateX(0)                          rotate(0deg);   opacity: 0; }
  8%   { opacity: var(--paw-opacity, 0.12); }
  25%  { transform: translateY(-25vh)  translateX(var(--paw-drift, 16px))     rotate(95deg); }
  50%  { transform: translateY(-55vh)  translateX(calc(var(--paw-drift, 16px) * -1)) rotate(190deg); }
  75%  { transform: translateY(-85vh)  translateX(var(--paw-drift, 16px))     rotate(280deg); }
  92%  { opacity: var(--paw-opacity, 0.12); }
  100% { transform: translateY(-115vh) translateX(0)                          rotate(360deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .paw-bg { display: none; }
}

/* ---------- Loading spinner ที่เป็นอุ้งตีนหมา ---------- */

.paw-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.paw-loading .paw-spin {
  width: 18px;
  height: auto;
  animation: paw-bounce 0.9s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes paw-bounce {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.6; }
  50% { transform: translateY(-5px) scale(1.08); opacity: 1; }
}

/* ---------- หน้าคิว: การ์ด grid + กระพริบสี ---------- */

.queue-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) { .queue-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .queue-grid { grid-template-columns: repeat(3, 1fr); } }

.queue-card { padding: 14px; }
.queue-card__link { display: block; }
.queue-card__link:active { opacity: 0.85; }

.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-dot--green { background: var(--success); }
.legend-dot--yellow { background: var(--warning); }

@keyframes card-blink-green {
  0%, 100% { box-shadow: var(--shadow); border-color: var(--border); }
  50% { box-shadow: 0 0 0 5px rgba(47, 158, 92, 0.28); border-color: var(--success); }
}
@keyframes card-blink-yellow {
  0%, 100% { box-shadow: var(--shadow); border-color: var(--border); }
  50% { box-shadow: 0 0 0 5px rgba(217, 154, 31, 0.32); border-color: var(--warning); }
}
.queue-card.blink-green { animation: card-blink-green 1.7s ease-in-out infinite; }
.queue-card.blink-yellow { animation: card-blink-yellow 1.1s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .queue-card.blink-green, .queue-card.blink-yellow { animation: none; border-color: var(--success); }
  .queue-card.blink-yellow { border-color: var(--warning); }
}

/* ---------- ปฏิทิน: เดือน / ปี / สัปดาห์ ---------- */

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.month-grid__weekday {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: 6px;
}
.month-grid__day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  gap: 2px;
}
.month-grid__day.is-other-month { opacity: 0.35; }
.month-grid__day.is-today { background: var(--brand); color: #fff; font-weight: 800; }
.month-grid__day.has-appt:not(.is-today) { background: var(--brand-light); }
.month-grid__day:hover { box-shadow: 0 0 0 3px var(--pop-blue-glow); }
.month-grid__day:active { box-shadow: 0 0 0 3px var(--pop-yellow-glow); }
.month-grid__count {
  font-size: 0.62rem;
  font-weight: 800;
  background: var(--pop-blue);
  color: #10405c;
  border-radius: 999px;
  padding: 0 5px;
  line-height: 1.4;
}
.month-grid__day.is-today .month-grid__count { background: #fff; color: var(--brand-dark); }

.year-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 640px) { .year-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .year-grid { grid-template-columns: repeat(4, 1fr); } }
.year-grid__month {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.year-grid__month.is-current { border-color: var(--brand); background: var(--brand-light); }
.year-grid__month:hover { box-shadow: 0 0 0 3px var(--pop-blue-glow); }
.year-grid__month:active { box-shadow: 0 0 0 3px var(--pop-yellow-glow); }

.week-agenda__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.week-agenda__row:hover { box-shadow: 0 0 0 3px var(--pop-blue-glow); }
.week-agenda__row:active { box-shadow: 0 0 0 3px var(--pop-yellow-glow); }
.week-agenda__time { font-weight: 700; color: var(--brand-dark); flex-shrink: 0; width: 44px; }
.week-agenda__info { flex: 1; color: var(--text); }

/* ---------- ซ่อนลูกศรขึ้น-ลงของช่องตัวเลข/ราคา — กันปัญหาเลื่อน touchpad แล้วค่าขยับ ---------- */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
