/* ระบบคลังภาพกิจกรรม — ทิศทาง "ทะเบียนภาพ": กระดาษขาว หมึกดำ แดงตรายาง ภาพจริงนำทุกอย่าง */
:root {
  --bg: #ffffff;
  --ink: #17191f;
  --ink-2: #545a66;
  --ink-3: #737985;
  --rule: #e7e7e4;
  --rule-2: #d6d6d2;
  --hover: #f7f7f5;
  --stamp: #c0262d;
  --stamp-ink: #a51f26;
  --stamp-soft: #fbeceb;
  --ok: #1f7a4a;
  --radius: 6px;
  --ease-press: cubic-bezier(.2, .9, .3, 1.15);
  --bs-body-font-family: 'Sarabun', system-ui, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--rule-2);
  --bs-border-radius: var(--radius);
  --bs-link-color-rgb: 23, 25, 31;
  --bs-link-hover-color-rgb: 192, 38, 45;
  --bs-focus-ring-color: rgba(192, 38, 45, .22);
}
body { background: var(--bg); font-family: 'Sarabun', system-ui, sans-serif; color: var(--ink); font-size: 15px; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { text-underline-offset: 3px; }
.min-w-0 { min-width: 0; }
.nowrap { white-space: nowrap; }

/* ---------- ปุ่มและฟอร์ม ---------- */
.btn { --bs-btn-font-weight: 600; --bs-btn-border-radius: var(--radius); transition: transform .08s, background-color .15s, border-color .15s, color .15s; }
.btn:active { transform: scale(.97); }
.btn-ink { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-color: #fff; --bs-btn-hover-bg: #2b2e36; --bs-btn-hover-border-color: #2b2e36; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #000; --bs-btn-active-border-color: #000; --bs-btn-active-color: #fff; --bs-btn-disabled-bg: #9a9da5; --bs-btn-disabled-border-color: #9a9da5; }
.btn-outline-ink, .btn-light { --bs-btn-bg: #fff; --bs-btn-color: var(--ink); --bs-btn-border-color: var(--rule-2); --bs-btn-hover-bg: var(--hover); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #b9b9b4; --bs-btn-active-bg: #efefec; --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: #b9b9b4; }
.btn-check:checked + .btn-outline-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-text { background: none; border: 0; padding: .35rem .2rem; color: var(--ink-2); font-weight: 600; display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; border-radius: 4px; }
.btn-text:hover { color: var(--ink); }
.btn-text:active { transform: scale(.97); }
.btn-text.danger { color: var(--stamp-ink); }
.badge-ink { background: var(--ink); color: #fff; font-weight: 600; }
.form-control, .form-select { border-color: var(--rule-2); }
.form-control:focus, .form-select:focus { border-color: var(--stamp); box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-check-input:focus { border-color: var(--stamp); box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }
.form-label { font-weight: 600; font-size: .92rem; }
.page-link { color: var(--ink); border-color: var(--rule); }
.active > .page-link { background: var(--ink); border-color: var(--ink); }
label.req::after { content: ' *'; color: var(--stamp); }
.alert { border-radius: var(--radius); }
.dropdown-menu { border-color: var(--rule-2); border-radius: var(--radius); box-shadow: 0 8px 24px -12px rgba(0, 0, 0, .25); font-size: .95rem; }
.modal-content { border-radius: 10px; border: 0; }

/* ---------- แถบบน ---------- */
.topbar { border-bottom: 1px solid var(--ink); background: var(--bg); }
.topbar .container-xl { min-height: 62px; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border: 1.5px solid var(--stamp); border-radius: 5px; color: var(--stamp); display: inline-grid; place-items: center; font-size: 1.05rem; transform: rotate(-3deg); flex: none; }
.brand-mark.lg { width: 52px; height: 52px; font-size: 1.5rem; border-width: 2px; }
.brand-title { font-weight: 700; font-size: 1.05rem; line-height: 1.2; display: block; }
.brand-sub { font-size: .8rem; color: var(--ink-2); display: block; }
.topbar .container-xl { align-items: stretch; }
.brand, .nav-toggle { align-self: center; }
.topnav { display: flex; align-items: stretch; gap: .15rem; margin-left: auto; }
.topnav > .btn, .topnav > .dropdown { align-self: center; }
.topnav .nav-link { color: var(--ink-2); padding: .5rem .7rem; font-weight: 500; border-bottom: 2px solid transparent; border-radius: 0; display: flex; align-items: center; }
.topnav > .nav-link { padding-top: calc(.5rem + 2px); }
.topnav .nav-link:hover { color: var(--ink); }
.topnav .nav-link.active { color: var(--ink); border-bottom-color: var(--stamp); font-weight: 600; }
.topnav .btn { margin-left: .5rem; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; font-size: 1.6rem; color: var(--ink); padding: 0 .25rem; }
@media (max-width: 767px) {
  .nav-toggle { display: block; }
  .topbar .container-xl { align-items: center; }
  .topnav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: .3rem 0 .8rem; margin: 0; }
  .topnav > .btn, .topnav > .dropdown { align-self: stretch; }
  .topnav.show { display: flex; }
  .topnav .nav-link { padding: .6rem 0; border-bottom: 1px solid var(--rule); }
  .topnav .nav-link.active { border-bottom-color: var(--rule); color: var(--stamp-ink); }
  .topnav .btn { margin: .6rem 0 0; }
}

.site-foot { border-top: 1px solid var(--rule); color: var(--ink-2); font-size: .82rem; padding: 1rem 0; margin-top: 2.5rem; }

/* ---------- ทั่วไป ---------- */
.panel { background: #fff; border: 1px solid var(--rule); border-radius: 8px; }
.page-title { font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 700; line-height: 1.28; letter-spacing: -.005em; text-wrap: pretty; }
.sec-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; }
.crumbs { font-size: .88rem; color: var(--ink-2); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--stamp-ink); text-decoration: underline; }
.empty { text-align: center; padding: 4.5rem 1rem; color: var(--ink-2); }
.empty .brand-mark { margin-bottom: 1rem; }

/* ---------- ตรายางวันที่ ---------- */
.stamp { width: 70px; height: 76px; border: 1.5px solid var(--stamp); border-radius: 6px; color: var(--stamp); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; transform: rotate(-2deg); flex: none; background: #fff; }
.stamp b { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.stamp b.range { font-size: 20px; }
.stamp span { font-size: 13px; font-weight: 600; margin-top: 7px; color: var(--stamp-ink); }
.stamp.lg { width: 84px; height: 92px; border-width: 2px; }
.stamp.lg b { font-size: 38px; }
.stamp.lg b.range { font-size: 24px; }
.stamp.lg span { font-size: 14px; }
.stamp.lg small { font-size: 12px; margin-top: 3px; color: var(--stamp-ink); font-weight: 600; }
@keyframes stamp-press {
  0% { transform: rotate(-9deg) scale(1.22); opacity: 0; }
  55% { transform: rotate(-2deg) scale(.96); opacity: 1; }
  100% { transform: rotate(-2deg) scale(1); opacity: 1; }
}
.intro .stamp { animation: stamp-press .34s var(--ease-press) both; animation-delay: var(--d, 0ms); }
.intro .reg-row .reg-info, .intro .reg-row .film { animation: fade-up .3s ease-out both; animation-delay: calc(var(--d, 0ms) + 60ms); }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- หน้าแรก: ทะเบียนภาพ ---------- */
.reg-bar { display: flex; align-items: flex-end; gap: 1rem 1.5rem; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.year-tabs { display: flex; gap: 1.6rem; overflow-x: auto; scrollbar-width: none; }
.year-tabs::-webkit-scrollbar { display: none; }
.year-tabs a { padding: .9rem 0 .7rem; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.year-tabs a:hover { color: var(--ink); }
.year-tabs a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--stamp); }
.reg-tools { margin-left: auto; display: flex; align-items: center; gap: .5rem; padding-bottom: .55rem; }
.reg-sum { color: var(--ink-2); font-size: .9rem; white-space: nowrap; margin-right: .5rem; }
.search-wrap { position: relative; width: 300px; }
.search-wrap i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-wrap .form-control { padding-left: 2.15rem; height: 38px; }
.filter-btn { height: 38px; }
.filter-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--stamp); display: inline-block; margin-left: .3rem; vertical-align: middle; }
.filter-menu { width: 280px; padding: .9rem; }
.active-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; font-size: .88rem; color: var(--ink-2); align-items: center; }
.active-filters a { color: var(--ink); background: var(--hover); border: 1px solid var(--rule); border-radius: 4px; padding: .1rem .5rem; text-decoration: none; }
.active-filters a:hover { border-color: var(--stamp); color: var(--stamp-ink); }

.month-div { display: flex; align-items: baseline; gap: .8rem; margin: 1.6rem 0 .2rem; font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.month-div::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.reg-row { display: grid; grid-template-columns: 84px minmax(0, 380px) minmax(0, 1fr); gap: 1.4rem; align-items: center; padding: .95rem .5rem .95rem 0; border-bottom: 1px solid var(--rule); color: inherit; text-decoration: none; transition: background-color .15s; }
.reg-row:hover { background: var(--hover); color: inherit; }
.reg-row:hover .reg-title { text-decoration: underline; text-decoration-color: var(--rule-2); }
.reg-row .stamp { margin-left: 6px; }
.reg-title { font-size: 1.12rem; font-weight: 600; line-height: 1.38; text-wrap: pretty; }
.reg-title i { color: var(--ink-3); font-size: .9rem; margin-left: .3rem; }
.reg-meta { color: var(--ink-2); font-size: .88rem; margin-top: .35rem; }
.reg-meta b { color: var(--ink); font-weight: 600; }
.film { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; height: 96px; }
.film img { width: 100%; height: 96px; object-fit: cover; display: block; border-radius: 2px; background: #eeeeeb; }
.film .more { position: relative; }
.film .more::after { content: attr(data-more); position: absolute; inset: 0; background: rgba(23, 25, 31, .62); color: #fff; font-weight: 600; font-size: 1.02rem; display: grid; place-items: center; border-radius: 2px; }
.film-empty { grid-column: 1 / -1; border: 1px dashed var(--rule-2); border-radius: 4px; display: flex; align-items: center; justify-content: center; gap: .4rem; color: var(--ink-3); font-size: .9rem; }

/* ---------- หน้าอัลบั้ม ---------- */
.al-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1.4rem; align-items: start; padding: 1.4rem 0 1.2rem; border-bottom: 1px solid var(--rule); }
.al-head .stamp { margin-top: .3rem; }
.al-meta { color: var(--ink-2); font-size: .95rem; margin: .45rem 0 0; overflow-wrap: break-word; }
#photoCount { display: inline-block; font-variant-numeric: tabular-nums; }
.al-meta .sep { color: #b9b9b4; margin: 0 0 0 .45rem; }
.al-meta .vis { color: var(--ink); font-weight: 600; }
.al-meta .vis.internal { color: var(--stamp-ink); }
.album-desc { color: var(--ink-2); max-width: 68ch; margin: .6rem 0 0; line-height: 1.65; }
.album-desc b { color: var(--ink); font-weight: 600; }
.al-actions { display: flex; gap: .2rem .9rem; flex-wrap: wrap; justify-content: flex-end; padding-top: .4rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; padding: .8rem 0; }
.seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 2px; position: relative; }
.seg label { padding: .28rem .8rem; border-radius: 4px; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: .9rem; position: relative; z-index: 1; transition: color .2s; user-select: none; }
.seg input:checked + label { color: #fff; }
.seg .seg-thumb { position: absolute; top: 2px; bottom: 2px; left: 0; width: 0; background: var(--ink); border-radius: 4px; transition: transform .22s var(--ease-press), width .22s var(--ease-press); }
.seg input:focus-visible + label { outline: 2px solid var(--stamp); outline-offset: 1px; }
.sel-actions, .sort-actions { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; }
.sel-actions.d-none, .sort-actions.d-none { display: none !important; }
.tool-count { margin-left: auto; color: var(--ink-2); font-size: .9rem; }

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; padding: 3.2rem 1rem; border: 1.5px dashed var(--rule-2); border-radius: 8px; cursor: pointer; text-align: center; margin: 1rem 0 0; transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--stamp); background: var(--stamp-soft); }
.dropzone > i { font-size: 2rem; color: var(--stamp); }
.dz-title { font-weight: 600; font-size: 1.05rem; }
.dz-sub { font-size: .88rem; color: var(--ink-2); }
.dropzone.disabled { cursor: not-allowed; border-color: var(--rule-2); background: var(--hover); }
.dropzone.disabled > i { color: var(--ink-3); }
.drop-veil { position: fixed; inset: 0; z-index: 1500; background: rgba(255, 255, 255, .86); border: 3px dashed var(--stamp); display: none; align-items: center; justify-content: center; flex-direction: column; gap: .4rem; font-size: 1.2rem; font-weight: 600; color: var(--stamp-ink); pointer-events: none; }
.drop-veil i { font-size: 2.4rem; }
.drop-veil.show { display: flex; }
.notready { font-size: .9rem; color: var(--stamp-ink); display: flex; gap: .4rem; align-items: center; }

.upload-panel { border: 1px solid var(--rule); border-radius: 8px; padding: .7rem .9rem; margin-bottom: .8rem; }
.upload-panel .progress { height: 4px; background: #efefec; border-radius: 2px; }
.upload-panel .progress-bar { background: var(--ink); transition: width .25s; }
.upload-panel .progress-bar.bg-success { background: var(--ok) !important; }
.upload-panel .progress-bar.bg-warning { background: var(--stamp) !important; }
.up-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .45rem; font-size: .95rem; }
.up-list { list-style: none; padding: 0; margin: .5rem 0 0; max-height: 132px; overflow-y: auto; font-size: .86rem; }
.up-list li { display: flex; gap: .5rem; align-items: center; padding: .12rem 0; }
.up-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-list .st { color: var(--ink-2); white-space: nowrap; font-size: .82rem; }
.up-list .st-done { display: none; }
.up-list .st-fail i, .up-list .st-fail .st { color: var(--stamp-ink); }
.up-list .st-up i, .up-list .st-prep i { color: var(--ink); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 4px; }
.ph { position: relative; margin: 0; aspect-ratio: 1; overflow: hidden; border-radius: 2px; background: #eeeeeb; cursor: zoom-in; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.ph:hover img { transform: scale(1.03); }
.ph.is-new { animation: ph-press .26s var(--ease-press) both; }
@keyframes ph-press { from { opacity: 0; transform: scale(1.07); } to { opacity: 1; transform: none; } }
.ph figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.4rem .55rem .4rem; font-size: .8rem; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.ph-tools { position: absolute; top: .35rem; right: .35rem; display: flex; gap: .25rem; opacity: 0; transition: opacity .15s; }
.ph:hover .ph-tools, .ph:focus-within .ph-tools, .ph.is-cover .ph-tools { opacity: 1; }
.ph.is-cover:not(:hover) .ph-cap { display: none; }
.ph-btn { width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--ink); display: grid; place-items: center; font-size: .9rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.ph-btn:hover { color: var(--stamp); }
.ph-btn:active { transform: scale(.92); }
.ph-cover { color: var(--ink-3); }
.ph.is-cover .ph-cover { background: var(--stamp); color: #fff; }
@media (hover: none) { .ph-tools { display: none; } }
.lb-btn.on { background: var(--stamp); }
.lb-btn.on .bi-star::before { content: "\f586"; }
.ph-check { position: absolute; top: .45rem; left: .45rem; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .28); color: transparent; display: none; place-items: center; font-size: .95rem; transition: transform .15s var(--ease-press); }
.mode-select .ph { cursor: pointer; }
.mode-select .ph-check { display: grid; }
.mode-select .ph-tools, .mode-sort .ph-tools { display: none; }
.ph.selected { box-shadow: inset 0 0 0 3px var(--stamp); }
.ph.selected .ph-check { background: var(--stamp); border-color: var(--stamp); color: #fff; transform: scale(1.1); }
.ph.selected img { transform: scale(.9); }
.mode-sort .ph { cursor: grab; }
.mode-sort .ph:hover img { transform: none; }
.ph-ghost { opacity: .3; }

.qr-box { width: 216px; height: 216px; padding: 8px; background: #fff; border: 1.5px solid var(--stamp); border-radius: 8px; }
.qr-box img, .qr-box canvas { width: 200px !important; height: 200px !important; }
.cap-preview { width: 100%; max-height: 220px; object-fit: contain; background: var(--hover); border-radius: 6px; }

.toast-note { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: .55rem 1rem; border-radius: 6px; font-size: .92rem; opacity: 0; transition: opacity .2s, transform .2s; z-index: 2100; pointer-events: none; }
.toast-note.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- ดูภาพเต็มจอ ---------- */
.lb { position: fixed; inset: 0; z-index: 2000; display: none; color: #fff; }
.lb.open { display: block; }
.lb-bg { position: absolute; inset: 0; background: #0d0e11; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; z-index: 3; }
.lb-count { font-size: .9rem; color: #c7cad1; font-variant-numeric: tabular-nums; }
.lb-tools { display: flex; gap: .3rem; }
.lb-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff; display: grid; place-items: center; font-size: 1.05rem; text-decoration: none; }
.lb-btn:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.lb-stage { position: absolute; inset: 58px 64px 66px; display: grid; grid-template-rows: 100%; grid-template-columns: 100%; }
.lb-stage img { grid-area: 1 / 1; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; position: relative; }
/* ภาพเบลอเป็นแค่ตัวรอระหว่างโหลด: อยู่ชั้นล่างเสมอ และหายไปเมื่อภาพจริงขึ้นแล้ว
   (filter/opacity ทำให้มันถูกวาดทับภาพจริงได้ถ้าไม่กำหนด z-index) */
.lb-ph { filter: blur(6px); opacity: .5; z-index: 0; transition: opacity .2s; }
.lb-ph.gone { opacity: 0; }
.lb-img { opacity: 0; transition: opacity .2s; z-index: 1; }
.lb-img.ready { opacity: 1; }
.lb.flying .lb-stage, .lb.flying .lb-cap { visibility: hidden; }
.lb-ghost { position: fixed; z-index: 2001; object-fit: cover; pointer-events: none; border-radius: 2px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.4rem; z-index: 3; display: grid; place-items: center; }
.lb-nav:hover { background: rgba(255, 255, 255, .22); }
.lb-prev { left: .6rem; }
.lb-next { right: .6rem; }
.lb-cap { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; padding: .9rem 1rem 1.1rem; font-size: 1rem; color: #eceef2; z-index: 2; }
.lb-cap.empty { display: none; }
@media (max-width: 640px) { .lb-stage { inset: 58px 0 62px; } .lb-nav { display: none; } }

/* ---------- ฟอร์มและหน้าตั้งค่า ---------- */
.vis-card { display: flex; flex-direction: column; gap: .15rem; height: 100%; padding: .75rem .9rem; border: 1px solid var(--rule-2); border-radius: var(--radius); cursor: pointer; background: #fff; transition: border-color .15s, box-shadow .15s; }
.vis-card i { font-size: 1.15rem; color: var(--ink-3); }
.vis-card small { color: var(--ink-2); font-size: .82rem; line-height: 1.4; }
.btn-check:checked + .vis-card { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.btn-check:checked + .vis-card i { color: var(--stamp); }
.btn-check:focus-visible + .vis-card { outline: 2px solid var(--stamp); outline-offset: 2px; }
.danger-zone { border-color: #efc9c9; }
.steps { display: grid; gap: .5rem; }
.step { display: flex; gap: .7rem; align-items: flex-start; font-size: .92rem; }
.step > span { flex: none; width: 24px; height: 24px; border-radius: 4px; border: 1.5px solid var(--stamp); color: var(--stamp); display: grid; place-items: center; font-size: .8rem; font-weight: 700; margin-top: .1rem; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; background: #fafaf9; }
.dim { opacity: .45; pointer-events: none; }
.save-bar { position: sticky; bottom: 0; padding: .8rem 0; background: linear-gradient(transparent, var(--bg) 35%); }
.stat-list { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; font-size: .92rem; }
.stat-list dt { font-weight: 400; color: var(--ink-2); }
.stat-list dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.login-card { max-width: 400px; }
.table { --bs-table-border-color: var(--rule); }
.table thead th { font-weight: 600; color: var(--ink-2); font-size: .88rem; border-bottom-color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}

/* ---------- มือถือ ---------- */
@media (max-width: 767px) {
  .reg-tools { margin-left: 0; width: 100%; padding-bottom: .7rem; }
  .search-wrap { flex: 1; width: auto; }
  .reg-sum { display: none; }
  .reg-row { grid-template-columns: 62px minmax(0, 1fr); grid-template-areas: "stamp info" "film film"; gap: .7rem .9rem; padding: .9rem 0; }
  .reg-row .stamp { grid-area: stamp; width: 56px; height: 62px; margin-left: 2px; }
  .reg-row .stamp b { font-size: 24px; }
  .reg-row .stamp b.range { font-size: 16px; }
  .reg-row .stamp span { font-size: 12px; margin-top: 5px; }
  .reg-info { grid-area: info; }
  .film { grid-area: film; height: 64px; }
  .film img { height: 64px; }
  .reg-title { font-size: 1.02rem; }
  .al-head { grid-template-columns: auto minmax(0, 1fr); gap: .3rem .9rem; padding-top: 1rem; align-items: center; }
  .al-main { display: contents; }
  .al-head .stamp { grid-row: 1 / span 2; grid-column: 1; margin-top: 0; }
  .al-head .crumbs { grid-column: 2; align-self: end; margin: 0 !important; }
  .al-head .page-title { grid-column: 2; align-self: start; font-size: 1.3rem; }
  .al-head .al-meta, .al-head .album-desc, .al-head .desc-more { grid-column: 1 / -1; }
  .album-desc.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .desc-more { justify-self: start; padding: 0; font-size: .9rem; }
  .al-actions #printBtn { display: none; }
  .al-head .stamp.lg { width: 64px; height: 70px; }
  .al-head .stamp.lg b { font-size: 28px; }
  .al-head .stamp.lg b.range { font-size: 18px; }
  .al-actions { grid-column: 1 / -1; justify-content: flex-start; padding-top: 0; }
  .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 2px; }
  .ph { border-radius: 0; }
  .tool-count { display: none; }
}

/* ---------- รายละเอียดเล็ก ๆ ให้เข้าชุด ---------- */
code { color: var(--ink-2); }
.form-range::-webkit-slider-thumb { background: var(--ink); }
.form-range::-moz-range-thumb { background: var(--ink); }
.form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }
.text-success { color: var(--ok) !important; }

/* ภาพที่โหลดไม่ได้ทุกแหล่ง: พื้นเทาพร้อมไอคอนกล้อง แทนไอคอน "?" ของเบราว์เซอร์ */
.ph:has(img.img-broken)::after { content: "\F220"; font-family: "bootstrap-icons"; position: absolute; inset: 0; display: grid; place-items: center; color: #b9b9b4; font-size: 1.4rem; pointer-events: none; }
