/* =========================================================
   Classroom Readiness Inspection System — Theme
   ชมพูโอรส (Pink Pastel) · ขาว · เทาอ่อน
   ========================================================= */
:root {
  --pink-50: #fff5f8;
  --pink-100: #fde4ee;
  --pink-200: #f9c9db;
  --pink-300: #f3a7c3;
  --pink-400: #e88aab;
  --pink-500: #d9668f;
  --pink-600: #bf4c76;
  --pink-700: #9b3a5e;
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --radius: 16px;

  --app-font: 'Prompt', system-ui, sans-serif;
  --app-font-weight: 300;
  --bs-body-font-family: var(--app-font);
  --bs-body-bg: #f6f6f8;
  --bs-border-radius: .65rem;

  --app-surface: #ffffff;
  --app-sidebar-bg: #ffffff;
  --app-sidebar-text: #4b4b57;
  --app-muted-bg: #f3f4f6;
}
[data-bs-theme="dark"] {
  --bs-body-bg: #16151a;
  --bs-body-color: #e6e4ea;
  --app-surface: #211f26;
  --app-sidebar-bg: #1c1a21;
  --app-sidebar-text: #cfcbd6;
  --app-muted-bg: #2a2830;
}

/* ฟอนต์เดียวกันทั้งระบบ (เลือกได้ในหน้า ตั้งค่าระบบ / ข้อมูลส่วนตัว) */
body, button, input, select, textarea, .tooltip, .popover, .swal2-popup, .dropdown-menu { font-family: var(--app-font) !important; }
body { font-size: .96rem; font-weight: var(--app-font-weight); -webkit-font-smoothing: antialiased; }
b, strong, .fw-semibold, th, .btn, .badge, .nav-link, .form-label, label { font-weight: 500; }
.fw-bold { font-weight: 600 !important; }
h1, h2, h3, h4, h5, h6, .font-prompt { font-family: var(--app-font); font-weight: 600; letter-spacing: -.005em; }

/* ----- Bootstrap overrides ----- */
.btn-primary {
  --bs-btn-bg: var(--pink-500); --bs-btn-border-color: var(--pink-500);
  --bs-btn-hover-bg: var(--pink-600); --bs-btn-hover-border-color: var(--pink-600);
  --bs-btn-active-bg: var(--pink-700); --bs-btn-active-border-color: var(--pink-700);
  --bs-btn-disabled-bg: var(--pink-300); --bs-btn-disabled-border-color: var(--pink-300);
  --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--pink-600); --bs-btn-border-color: var(--pink-300);
  --bs-btn-hover-bg: var(--pink-500); --bs-btn-hover-border-color: var(--pink-500); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--pink-600); --bs-btn-active-border-color: var(--pink-600);
}
.btn-soft { background: var(--pink-100); color: var(--pink-700); border: 0; }
.btn-soft:hover { background: var(--pink-200); color: var(--pink-700); }
[data-bs-theme="dark"] .btn-soft { color: var(--pink-300); }
.text-primary { color: var(--pink-600) !important; }
[data-bs-theme="dark"] .text-primary { color: var(--pink-300) !important; }
.bg-primary { background-color: var(--pink-500) !important; }
.bg-pink-soft { background: var(--pink-100) !important; }
.form-control:focus, .form-select:focus { border-color: var(--pink-300); box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb),.18); }
.form-check-input:checked { background-color: var(--pink-500); border-color: var(--pink-500); }
.page-link { color: var(--pink-600); }
.active > .page-link, .page-link.active { background-color: var(--pink-500); border-color: var(--pink-500); }
.nav-pills .nav-link.active { background: var(--pink-500); }
.nav-pills .nav-link { color: var(--app-sidebar-text); }
.card { border: 0; border-radius: var(--radius); background: var(--app-surface); box-shadow: 0 1px 2px rgba(20,20,40,.04), 0 4px 16px rgba(20,20,40,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--bs-border-color-translucent); padding: 1rem 1.25rem; }
.modal-content { border: 0; border-radius: 20px; background: var(--app-surface); }
.modal-header { border-bottom: 0; padding-bottom: .25rem; }
.modal-footer { border-top: 0; }
.dropdown-menu { border-radius: 14px; background: var(--app-surface); }
.table { --bs-table-bg: transparent; }
.table > thead th { font-weight: 600; font-size: .85rem; color: var(--bs-secondary-color); background: var(--app-muted-bg); border-bottom: 0; white-space: nowrap; }
.table > thead th:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.table > thead th:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
.table td { vertical-align: middle; }
.badge { font-weight: 500; }

/* ----- Layout ----- */
.app-wrapper { display: flex; min-height: 100vh; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: var(--app-sidebar-bg); border-right: 1px solid var(--bs-border-color-translucent);
  display: flex; flex-direction: column; transition: transform .25s ease, width .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.2rem; height: var(--topbar-h); text-decoration: none; color: inherit; }
.brand-title { font-weight: 600; color: var(--pink-600); font-size: 1.02rem; }
[data-bs-theme="dark"] .brand-title { color: var(--pink-300); }
.brand-sub { font-size: .75rem; color: var(--bs-secondary-color); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .75rem; padding: .62rem .85rem; margin-bottom: 2px;
  color: var(--app-sidebar-text); border-radius: 12px; font-weight: 500; font-size: .93rem;
  transition: background .15s, color .15s, transform .15s; white-space: nowrap;
}
.sidebar-nav .nav-link i { font-size: 1.12rem; width: 1.3rem; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--pink-50); color: var(--pink-600); transform: translateX(2px); }
.sidebar-nav .nav-link.active { background: linear-gradient(90deg, var(--pink-500), var(--acc-500)); color: #fff; box-shadow: 0 6px 16px rgba(var(--bs-primary-rgb),.30); }
.sidebar-heading { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bs-secondary-color); padding: .9rem .85rem .35rem; font-weight: 600; white-space: nowrap; }
body.sidebar-collapsed .sidebar-heading { visibility: hidden; height: .6rem; padding: 0; }

/* ----- แถบเมนูสีเข้ม ----- */
body.sb-dark .app-sidebar {
  background: linear-gradient(180deg, color-mix(in srgb, var(--pink-500) 18%, #15121b) 0%, color-mix(in srgb, var(--acc-500) 16%, #100e15) 100%);
  border-right: 0; color: #ece9f1; box-shadow: 4px 0 24px rgba(10, 8, 16, .12);
}
body.sb-dark .brand-title { color: #fff; }
body.sb-dark .brand-sub, body.sb-dark .sidebar-heading { color: rgba(255,255,255,.5); }
body.sb-dark .sidebar-nav .nav-link { color: rgba(255,255,255,.74); }
body.sb-dark .sidebar-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
body.sb-dark .sidebar-nav .nav-link.active { color: #fff; box-shadow: 0 8px 22px rgba(var(--bs-primary-rgb),.45); }
body.sb-dark .sidebar-footer { color: rgba(255,255,255,.5); border-top-color: rgba(255,255,255,.08); }
body.sb-dark .sidebar-nav { scrollbar-color: rgba(255,255,255,.2) transparent; }

/* ----- แถบเมนูไล่สีตามธีม ----- */
body.sb-brand .app-sidebar { background: linear-gradient(165deg, var(--pink-600) 0%, var(--acc-600) 100%); border-right: 0; color: #fff; }
body.sb-brand .brand-title { color: #fff; }
body.sb-brand .brand-sub, body.sb-brand .sidebar-heading { color: rgba(255,255,255,.7); }
body.sb-brand .sidebar-nav .nav-link { color: rgba(255,255,255,.88); }
body.sb-brand .sidebar-nav .nav-link:hover { background: rgba(255,255,255,.14); color: #fff; }
body.sb-brand .sidebar-nav .nav-link.active { background: rgba(255,255,255,.95); color: var(--pink-700); box-shadow: 0 8px 20px rgba(0,0,0,.15); }
body.sb-brand .sidebar-footer { color: rgba(255,255,255,.75); border-top-color: rgba(255,255,255,.18); }
.sidebar-footer { padding: .9rem 1.2rem; color: var(--bs-secondary-color); border-top: 1px solid var(--bs-border-color-translucent); }

.app-main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin .25s ease; }
.app-topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--topbar-h);
  display: flex; align-items: center; gap: .5rem; padding: 0 1rem 0 1.25rem;
  background: color-mix(in srgb, var(--app-surface) 85%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bs-border-color-translucent);
}
.topbar-title { font-size: 1.12rem; margin: 0; font-weight: 500; }
.app-content { padding: 1.5rem; flex: 1; animation: fadeUp .35s ease backwards; }
.app-footer { padding: 1rem 1.5rem; text-align: center; }
.btn-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 0; color: var(--bs-body-color); }
.btn-icon:hover { background: var(--app-muted-bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--pink-500), var(--acc-500)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }

body.sidebar-collapsed .app-sidebar { width: 76px; }
body.sidebar-collapsed .app-main { margin-left: 76px; }
body.sidebar-collapsed .sidebar-nav .nav-link span, body.sidebar-collapsed .sidebar-brand .lh-sm, body.sidebar-collapsed .sidebar-footer { display: none; }
body.sidebar-collapsed .sidebar-nav .nav-link { justify-content: center; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: none; }
  .app-main { margin-left: 0 !important; }
  body.sidebar-open .app-sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .app-content { padding: 1rem .85rem 5rem; }
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035; }

/* ----- Notifications ----- */
.noti-badge { position: absolute; top: 3px; right: 1px; background: #dc3545; color: #fff; font-size: .65rem; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.noti-menu { width: min(370px, 94vw); }
.noti-list { max-height: 400px; overflow-y: auto; overflow-x: hidden; }
.noti-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.noti-msg { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.noti-menu { overflow: hidden; }
.noti-item { display: flex; gap: .7rem; padding: .7rem 1rem; text-decoration: none; color: inherit; border-bottom: 1px solid var(--bs-border-color-translucent); }
.noti-item:hover { background: var(--app-muted-bg); }
.noti-item.unread { background: var(--pink-50); }
.noti-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--pink-100); color: var(--pink-600); }

/* ----- Stat cards ----- */
.stat-card { position: relative; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(20,20,40,.08); }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-card .stat-value { font-size: 1.85rem; font-weight: 600; line-height: 1.1; }
.stat-card .stat-label { color: var(--bs-secondary-color); font-size: .88rem; }
.stat-card::after { content: ''; position: absolute; right: -24px; bottom: -24px; width: 96px; height: 96px; border-radius: 50%; background: currentColor; opacity: .05; }
.icon-pink { background: var(--pink-100); color: var(--pink-600); }
.icon-green { background: #dcf5e7; color: #198754; }
.icon-yellow { background: #fff3cd; color: #b58100; }
.icon-red { background: #fde2e4; color: #dc3545; }
.icon-blue { background: #e0ecff; color: #3b6fd8; }
.icon-gray { background: var(--app-muted-bg); color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .icon-green { background: #173a29; }
[data-bs-theme="dark"] .icon-yellow { background: #3d3214; color: #ffd45e; }
[data-bs-theme="dark"] .icon-red { background: #3e1a1f; }
[data-bs-theme="dark"] .icon-blue { background: #1b2a47; color: #8fb3ff; }

.chart-box { position: relative; height: 280px; }

/* ----- Page header ----- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.page-head h2 { font-size: 1.35rem; margin: 0; }
.filter-bar { background: var(--app-surface); border-radius: var(--radius); padding: .9rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(20,20,40,.04); }

/* ----- Inspection checklist (mobile first) ----- */
.insp-sticky { position: sticky; top: calc(var(--topbar-h) + 4px); z-index: 1020; }
.insp-progress { height: 10px; border-radius: 6px; background: var(--app-muted-bg); }
.check-item { border: 1px solid var(--bs-border-color-translucent); border-radius: 14px; padding: .85rem; margin-bottom: .65rem; background: var(--app-surface); transition: border-color .2s, box-shadow .2s; }
.check-item.is-pass { border-left: 5px solid #198754; }
.check-item.is-fail { border-left: 5px solid #dc3545; background: color-mix(in srgb, #dc3545 4%, var(--app-surface)); }
.check-item.is-repair { border-left: 5px solid #f0ad4e; background: color-mix(in srgb, #f0ad4e 6%, var(--app-surface)); }
.check-item.is-na { border-left: 5px solid #adb5bd; }
.check-item.is-pending { border-left: 5px solid var(--bs-border-color); }
.result-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.result-group .btn { padding: .55rem .25rem; font-size: .88rem; border-radius: 10px; white-space: nowrap; }
.result-sub { display: flex; gap: .25rem; justify-content: flex-end; }
.result-sub .btn { font-size: .78rem; padding: .1rem .4rem; text-decoration: none; }
.result-sub .btn-check:checked + .btn { color: var(--bs-body-color) !important; background: var(--app-muted-bg); border-radius: 8px; font-weight: 600; }
.item-no { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; background: var(--pink-100); color: var(--pink-700); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem; }
[data-bs-theme="dark"] .item-no { color: var(--pink-300); }
.btn-check:checked + .btn-outline-success { background: #198754; color: #fff; }
.btn-check:checked + .btn-outline-danger { background: #dc3545; color: #fff; }
.btn-check:checked + .btn-outline-secondary { background: #6c757d; color: #fff; }
.btn-check:checked + .btn-outline-warning { background: #f0ad4e; border-color: #f0ad4e; color: #fff; }
.btn-outline-warning { --bs-btn-color: #b7791f; --bs-btn-border-color: #f0c27a; --bs-btn-hover-bg: #f0ad4e; --bs-btn-hover-border-color: #f0ad4e; --bs-btn-hover-color: #fff; }
.fail-box { display: none; margin-top: .7rem; }
.check-item.is-fail .fail-box, .check-item.is-repair .fail-box { display: block; animation: fadeUp .25s ease; }
.check-item.is-fail .fail-label { color: var(--bs-danger); } .check-item.is-repair .fail-label { color: #b7791f; }
.photo-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.photo-thumb { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: var(--app-muted-bg); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photo-thumb .del { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: .75rem; display: flex; align-items: center; justify-content: center; }
.photo-add { width: 84px; height: 84px; border-radius: 12px; border: 2px dashed var(--pink-300); color: var(--pink-600); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .75rem; cursor: pointer; background: var(--pink-50); }
.photo-add i { font-size: 1.4rem; }
.cat-nav { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
.cat-nav .btn { white-space: nowrap; border-radius: 20px; }
.bottom-actions { position: sticky; bottom: 0; z-index: 1020; padding: .75rem; margin: 1rem -.25rem 0; background: color-mix(in srgb, var(--app-surface) 92%, transparent); backdrop-filter: blur(8px); border-radius: 16px; box-shadow: 0 -4px 18px rgba(0,0,0,.06); }
.save-indicator { font-size: .8rem; }

.room-card { transition: transform .15s ease, box-shadow .15s ease; }
.room-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(20,20,40,.08); }
.score-ring { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; background: conic-gradient(var(--ring-color, #198754) calc(var(--p, 0) * 1%), var(--app-muted-bg) 0); position: relative; }
.score-ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--app-surface); }
.score-ring span { position: relative; font-size: .9rem; }

.timeline { list-style: none; padding-left: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 4px; bottom: 4px; width: 2px; background: var(--bs-border-color); }
.timeline li { position: relative; padding-left: 44px; margin-bottom: 1rem; }
.timeline .dot { position: absolute; left: 4px; top: 2px; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; color: #fff; background: var(--pink-400); }

.login-page { min-height: 100vh; background: radial-gradient(circle at 10% 10%, var(--pink-100), transparent 42%), radial-gradient(circle at 90% 90%, var(--acc-100), transparent 42%), var(--bs-body-bg); }
.login-card { max-width: 420px; width: 100%; border-radius: 24px; }
.room-img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--app-muted-bg); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--bs-secondary-color); }
.empty-state i { font-size: 3rem; color: var(--pink-300); }
.cursor-pointer { cursor: pointer; }
.sortable-handle { cursor: grab; color: var(--bs-secondary-color); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp .4s ease backwards; }
.fade-up:nth-child(2) { animation-delay: .05s } .fade-up:nth-child(3) { animation-delay: .1s } .fade-up:nth-child(4) { animation-delay: .15s }
.fade-up:nth-child(5) { animation-delay: .2s } .fade-up:nth-child(6) { animation-delay: .25s }

@media print {
  .app-sidebar, .app-topbar, .app-footer, .no-print, .bottom-actions { display: none !important; }
  .app-main { margin: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ----- Theme picker ----- */
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--app-surface); box-shadow: 0 0 0 1px var(--bs-border-color); cursor: pointer; display: inline-block; transition: transform .15s; }
.swatch:hover { transform: scale(1.1); }
.btn-check:checked + .swatch { box-shadow: 0 0 0 3px var(--bs-body-color); }
.font-option { border: 1px solid var(--bs-border-color); border-radius: 12px; padding: .6rem .8rem; cursor: pointer; display: block; }
.btn-check:checked + .font-option { border-color: var(--pink-500); background: var(--pink-50); box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), .25); }
.app-logo { flex-shrink: 0; }

/* ----- Public board ----- */

.public-topbar { position: sticky; top: 0; z-index: 1030; background: color-mix(in srgb, var(--app-surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--bs-border-color-translucent); }
.room-tile { cursor: pointer; border-bottom: 4px solid var(--bs-border-color); }
.room-tile.st-ready { border-bottom-color: #22a06b; } .room-tile.st-ready_improve { border-bottom-color: #4fb3d9; }
.room-tile.st-not_ready { border-bottom-color: #e5484d; } .room-tile.st-urgent { border-bottom-color: #9b1c31; } .room-tile.st-pending { border-bottom-color: #f5c04a; }
.mark { font-size: 1.15rem; line-height: 1; }

/* ----- สีรอง (accent) ----- */
.progress-bar.bg-primary { background: linear-gradient(90deg, var(--pink-500), var(--acc-500)) !important; }
.text-accent { color: var(--acc-600) !important; }
.bg-accent { background: var(--acc-500) !important; color: #fff; }
.icon-acc { background: var(--acc-100); color: var(--acc-600); }
.theme-preview { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .6rem .8rem; border: 1px dashed var(--bs-border-color); border-radius: 12px; }
.theme-preview .tp-bar { width: 90px; height: 10px; border-radius: 6px; background: linear-gradient(90deg, var(--pink-500), var(--acc-500)); }
.theme-preview .tp-acc { background: var(--acc-500); color: #fff; }

/* ตัวอย่างรูปแบบแถบเมนู */
.sidebar-option { position: relative; width: 96px; height: 70px; border-radius: 12px; border: 2px solid var(--bs-border-color); overflow: hidden; cursor: pointer; display: block; background: var(--bs-body-bg); }
.sidebar-option .sbo-side { position: absolute; inset: 0 auto 0 0; width: 34%; display: flex; flex-direction: column; gap: 4px; padding: 8px 5px; }
.sidebar-option .sbo-side i { display: block; height: 5px; border-radius: 3px; background: rgba(127,127,127,.35); }
.sidebar-option .sbo-side i.on { background: linear-gradient(90deg, var(--pink-500), var(--acc-500)); }
.sidebar-option .sbo-label { position: absolute; right: 6px; bottom: 4px; font-size: .7rem; }
.sidebar-option.sb-dark .sbo-side { background: linear-gradient(180deg, color-mix(in srgb, var(--pink-500) 18%, #15121b), color-mix(in srgb, var(--acc-500) 16%, #100e15)); }
.sidebar-option.sb-brand .sbo-side { background: linear-gradient(165deg, var(--pink-600), var(--acc-600)); }
.sidebar-option.sb-brand .sbo-side i.on { background: #fff; }
.sidebar-option.sb-light .sbo-side { background: var(--app-surface); border-right: 1px solid var(--bs-border-color); }
.btn-check:checked + .sidebar-option { border-color: var(--pink-500); box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .2); }

/* โลโก้ที่อัปโหลด */
.brand-logo-img { object-fit: contain; border-radius: 10px; flex-shrink: 0; }
.logo-preview { width: 120px; height: 120px; border-radius: 18px; border: 1px dashed var(--bs-border-color); display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(rgba(127,127,127,.08) 0 25%, transparent 0 50%) 50% / 16px 16px; }

/* =========================================================
   อนิเมชัน (หน้าแรก / Dashboard) — ปิดอัตโนมัติเมื่อผู้ใช้ตั้งค่า "ลดการเคลื่อนไหว"
   ========================================================= */
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }
.score-ring[data-ring] { transition: --p 1.4s cubic-bezier(.2,.8,.2,1); }
.public-hero { position: relative; overflow: hidden; border-radius: 24px; padding: 1.75rem;
  background: linear-gradient(120deg, var(--pink-100), var(--app-surface) 45%, var(--acc-100)); background-size: 220% 220%; animation: heroShift 16s ease infinite; }
.public-hero > .row { position: relative; z-index: 1; }
.public-hero .blob { position: absolute; border-radius: 50%; filter: blur(42px); opacity: .5; pointer-events: none; animation: floatBlob 13s ease-in-out infinite; }
.public-hero .b1 { width: 280px; height: 280px; background: var(--pink-300); top: -110px; right: 6%; }
.public-hero .b2 { width: 220px; height: 220px; background: var(--acc-300); bottom: -120px; right: 38%; animation-delay: -4s; }
.public-hero .b3 { width: 150px; height: 150px; background: var(--acc-200); top: 25%; left: -50px; animation-delay: -8s; }
.hero-title .grad { background: linear-gradient(90deg, var(--pink-700), var(--acc-600)); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-bs-theme="dark"] .hero-title .grad { background: linear-gradient(90deg, var(--pink-300), var(--acc-300)); -webkit-background-clip: text; background-clip: text; }
.hero-progress { height: 10px; border-radius: 6px; background: rgba(127,127,127,.15); overflow: hidden; }
.hero-progress > span { position: relative; display: block; height: 100%; width: 0; border-radius: 6px; overflow: hidden;
  background: linear-gradient(90deg, var(--pink-500), var(--acc-500)); transition: width 1.8s cubic-bezier(.2,.8,.2,1); }
.hero-progress > span::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: shimmer 2.4s infinite; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #22a06b; display: inline-block; vertical-align: middle; animation: livePulse 2s infinite; }
[data-reveal] { opacity: 0; transform: translateY(24px) scale(.985); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); transition-delay: var(--d, 0s); }
[data-reveal].in { opacity: 1; transform: none; }
.room-tile { transition: transform .28s cubic-bezier(.2,.8,.2,1), box-shadow .28s; }
.room-tile:hover, .room-tile:focus-visible { transform: translateY(-5px); box-shadow: 0 16px 34px rgba(var(--bs-primary-rgb), .16); outline: none; }
.room-tile.st-urgent { animation: urgentGlow 2.6s ease-in-out infinite; }
.stat-card .stat-icon { transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.stat-card:hover .stat-icon { transform: rotate(-10deg) scale(1.12); }
#roomDetail tbody tr, #roomDetail .list-group-item { animation: fadeUp .45s ease both; animation-delay: var(--d, 0s); }
.public-topbar .app-logo, .public-topbar .brand-logo-img { transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.public-topbar a:hover .app-logo, .public-topbar a:hover .brand-logo-img { transform: rotate(-8deg) scale(1.06); }
@keyframes heroShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes floatBlob { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(24px, -18px) scale(1.08); } 66% { transform: translate(-18px, 12px) scale(.94); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(34,160,107,.55); } 70% { box-shadow: 0 0 0 10px rgba(34,160,107,0); } 100% { box-shadow: 0 0 0 0 rgba(34,160,107,0); } }
@keyframes urgentGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } 50% { box-shadow: 0 0 0 5px rgba(229,72,77,.2); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; }
}

/* =========================================================
   หน้าตรวจห้อง แบบมินิมอล (1 ข้อ = 1 แถว)
   ========================================================= */
.ci-head { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .92rem; padding: 0 .25rem .4rem; }
.ci-list { background: var(--app-surface); border-radius: 14px; box-shadow: 0 1px 2px rgba(20,20,40,.04), 0 2px 10px rgba(20,20,40,.04); overflow: hidden; }
.ci-list .check-item { border: 0; border-radius: 0; margin: 0; padding: .55rem .75rem; background: transparent; border-left: 3px solid transparent; border-bottom: 1px solid var(--bs-border-color-translucent); }
.ci-list .check-item:last-child { border-bottom: 0; }
.ci-list .check-item.is-pass { border-left-color: #22a06b; }
.ci-list .check-item.is-fail { border-left-color: #e5484d; background: color-mix(in srgb, #e5484d 4%, transparent); }
.ci-list .check-item.is-repair { border-left-color: #f0ad4e; background: color-mix(in srgb, #f0ad4e 5%, transparent); }
.ci-list .check-item.is-na { border-left-color: #adb5bd; }
.ci-list .check-item.is-na .ci-name { color: var(--bs-secondary-color); }
.ci-list .check-item.is-pending { border-left-color: transparent; }
.ci-row { display: flex; align-items: center; gap: .6rem; }
.ci-row .item-no { width: 24px; height: 24px; font-size: .75rem; border-radius: 7px; }
.ci-name { flex: 1; min-width: 0; font-size: .93rem; line-height: 1.35; }

/* ปุ่มเลือกผลแบบกลุ่ม (segmented) */
.seg { display: inline-flex; flex-shrink: 0; background: var(--app-muted-bg); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; height: 30px; min-width: 32px; padding: 0 .6rem; margin: 0;
  border-radius: 8px; font-size: .8rem; font-weight: 500; color: var(--bs-secondary-color); cursor: pointer; user-select: none; transition: background .15s, color .15s; white-space: nowrap; }
@media (hover: hover) { .seg-btn:hover { background: var(--app-surface); color: var(--bs-body-color); } }
.seg-na, .seg-pending { padding: 0 .45rem; }
.btn-check:focus-visible + .seg-btn { outline: 2px solid var(--pink-400); outline-offset: 1px; }
.btn-check:checked + .seg-pass { background: #22a06b; color: #fff; }
.btn-check:checked + .seg-fail { background: #e5484d; color: #fff; }
.btn-check:checked + .seg-repair { background: #f0ad4e; color: #fff; }
.btn-check:checked + .seg-na { background: #8a93a0; color: #fff; }
.btn-check:checked + .seg-pending { background: var(--app-surface); color: var(--bs-body-color); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.ci-note-btn { border: 0; background: transparent; color: var(--bs-secondary-color); width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
.ci-note-btn:hover, .show-note .ci-note-btn { background: var(--app-muted-bg); color: var(--pink-600); }
.ci-note { display: none; margin: .45rem 0 0 2.1rem; }
.show-note .ci-note { display: block; }
.ci-list .fail-box { margin: .5rem 0 0 2.1rem; }
.ci-list .fail-box textarea { resize: vertical; min-height: 34px; }
.photo-grid-sm .photo-thumb, .photo-grid-sm .photo-add { width: 52px; height: 52px; border-radius: 10px; }
.photo-grid-sm .photo-add i { font-size: 1.1rem; }
.photo-grid-sm .photo-thumb .del { width: 20px; height: 20px; }

/* มือถือ: ชื่อรายการด้านบน ปุ่มเต็มความกว้างด้านล่าง */
@media (max-width: 767.98px) {
  .ci-row { flex-wrap: wrap; row-gap: .45rem; }
  .ci-name { flex: 1 1 0; }
  .ci-row .seg { order: 3; flex: 1 1 100%; }
  .ci-row .seg-btn { flex: 1; padding: 0 .3rem; height: 34px; }
  .ci-row .seg-na, .ci-row .seg-pending { flex: 0 0 38px; }
  .ci-row .ci-note-btn { order: 2; }
  .ci-note, .ci-list .fail-box { margin-left: 0; }
}
@media (max-width: 380px) { .seg-btn span { font-size: .74rem; } }

/* =========================================================
   หน้าแรก: ส่วนหัวแบบเด่น (hero band)
   ========================================================= */
.hero-band { position: relative; color: #fff; overflow: hidden; isolation: isolate;
  background: linear-gradient(125deg, var(--pink-700) 0%, var(--pink-500) 38%, var(--acc-500) 72%, var(--acc-700) 100%);
  background-size: 200% 200%; animation: heroShift 18s ease infinite; }
.hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.10), rgba(0,0,0,.18)); }
.hero-band .blob { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .35; animation: floatBlob 14s ease-in-out infinite; }
.hero-band .b1 { width: 380px; height: 380px; background: #fff; top: -160px; right: 4%; opacity: .22; }
.hero-band .b2 { width: 300px; height: 300px; background: var(--acc-300); bottom: -140px; left: 30%; animation-delay: -5s; }
.hero-band .b3 { width: 220px; height: 220px; background: var(--pink-300); top: 10%; left: -80px; animation-delay: -9s; }
.hero-dots { position: absolute; inset: 0; opacity: .14; background-image: radial-gradient(#fff 1.2px, transparent 1.3px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(120deg, transparent 10%, #000 60%); mask-image: linear-gradient(120deg, transparent 10%, #000 60%); }
.hero-inner { padding: 3rem 0 5.5rem; }
.hero-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 500;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(6px); }
.hero-h1 { text-wrap: balance; font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.7rem); font-weight: 700; line-height: 1.25; margin: 1rem 0 .5rem; text-shadow: 0 2px 18px rgba(0,0,0,.18); letter-spacing: -.01em; }
.hero-lead { font-size: 1.05rem; color: rgba(255,255,255,.88); }
.hero-meta { display: flex; flex-wrap: wrap; gap: .5rem; }
.hero-meta span { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; padding: .35rem .75rem; border-radius: 10px; background: rgba(0,0,0,.14); color: rgba(255,255,255,.95); }
.hero-glass { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); border-radius: 22px; padding: 1.25rem; backdrop-filter: blur(14px); box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.hero-glass .form-select { background-color: rgba(255,255,255,.95); border: 0; color: #2b2833; }
.hero-ring { --p: 0; flex-shrink: 0; width: 108px; height: 108px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.22) 0); transition: --p 1.6s cubic-bezier(.2,.8,.2,1); }
.hero-ring::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: rgba(0,0,0,.16); backdrop-filter: blur(4px); }
.hero-ring > span { position: relative; text-align: center; line-height: 1.1; }
.hero-ring b { font-size: 1.5rem; display: block; }
.hero-ring small { font-size: .72rem; opacity: .85; }
.hero-big { font-size: 2.3rem; font-weight: 700; line-height: 1; }
.hero-big small { font-size: 1rem; font-weight: 500; }
.hero-sub { font-size: .9rem; opacity: .9; }
.hero-mini { font-size: .82rem; opacity: .9; }
.hero-wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 60px; fill: var(--bs-body-bg); }
.hero-stats { margin-top: -4.2rem; position: relative; z-index: 2; }
.stat-pop { box-shadow: 0 10px 30px rgba(20,20,40,.08); }
.stat-pop:hover { box-shadow: 0 16px 36px rgba(var(--bs-primary-rgb), .18); }
[data-bs-theme="dark"] .hero-glass .form-select { background-color: rgba(30,28,36,.92); color: #eee; }

/* ปุ่มกรองสถานะ */
.status-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.status-pills a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 999px; font-size: .85rem; text-decoration: none;
  color: var(--bs-body-color); background: var(--app-muted-bg); border: 1px solid transparent; transition: all .2s; }
.status-pills a b { font-weight: 600; }
.status-pills a i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-pills a:hover { border-color: var(--pink-300); }
.status-pills a.active { background: linear-gradient(90deg, var(--pink-500), var(--acc-500)); color: #fff; }
.pill-ready i { background: #22a06b; } .pill-ready_improve i { background: #4fb3d9; } .pill-not_ready i { background: #e5484d; }
.pill-urgent i { background: #9b1c31; } .pill-pending i { background: #f5c04a; }
.public-footer { background: var(--app-surface); border-top: 1px solid var(--bs-border-color-translucent); margin-top: 2rem; }
@media (max-width: 991.98px) { .hero-inner { padding: 2rem 0 5rem; } .hero-ring { width: 92px; height: 92px; } }

/* ----- รูปห้อง 4:3 ----- */
.room-tile { overflow: hidden; }
.room-photo { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(135deg, var(--pink-100), var(--acc-100)); }
.room-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .7s cubic-bezier(.2,.8,.2,1); }
.room-tile:hover .room-photo img { transform: scale(1.06); }
.room-photo .ph-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; color: var(--pink-500); }
.room-photo .ph-empty i { font-size: 2.6rem; opacity: .75; }
.room-photo .ph-empty span { font-size: .8rem; color: var(--bs-secondary-color); }
.room-photo .ph-status { position: absolute; left: .6rem; top: .6rem; padding: .25rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  color: #fff; background: rgba(30,30,40,.55); backdrop-filter: blur(6px); box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.room-photo .st-dot-ready { background: rgba(34,160,107,.92); }
.room-photo .st-dot-ready_improve { background: rgba(53,153,199,.92); }
.room-photo .st-dot-not_ready { background: rgba(229,72,77,.92); }
.room-photo .st-dot-urgent { background: rgba(155,28,49,.95); }
.room-photo .st-dot-pending { background: rgba(245,192,74,.95); color: #3b2f00; }
.room-photo::after { content: ''; position: absolute; inset: auto 0 0 0; height: 35%; background: linear-gradient(transparent, rgba(0,0,0,.12)); pointer-events: none; }
.room-photo-lg { border-radius: 14px; }
.row-inactive td:not(:last-child) { opacity: .5; }
