/* Ảnh trong hồ sơ (bản 1.22.0) – dùng cho cả trang bác sĩ và bệnh nhân */
.ph-strip { display: grid; gap: 8px; padding-top: 6px; border-top: 1px dashed var(--line-2); }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ph-grid.sm { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.ph-th { position: relative; padding: 0; border: none; border-radius: 12px; overflow: hidden; aspect-ratio: 1; background: var(--soft); cursor: pointer; }
.ph-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-th:focus-visible { outline: 3px solid var(--peach); outline-offset: 2px; }
.ph-th.up img { opacity: .55; }
.ph-th.err { outline: 2px solid var(--danger); }
.ph-st { position: absolute; left: 4px; right: 4px; bottom: 4px; font-size: 11px; line-height: 1.2; background: rgba(43, 33, 37, .75); color: #fff; border-radius: 6px; padding: 2px 4px; }
.ph-st.err { background: var(--danger); }
.ph-eye { position: absolute; top: 4px; right: 4px; font-size: 12px; background: rgba(255, 255, 255, .9); border-radius: 999px; padding: 0 5px; }
.ph-more { display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--soft); font-weight: 600; text-decoration: none; aspect-ratio: 1; }
.chip.on { background: var(--ink); color: #fff; }

/* Xem ảnh lớn: toàn màn hình trên điện thoại */
dialog.ph-view { width: min(980px, 100vw); max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: auto; border-radius: 0; background: #111; color: #fff; padding: 0; display: flex; flex-direction: column; }
dialog.ph-view:not([open]) { display: none; }
@media (min-width: 768px) { dialog.ph-view { height: min(92vh, 900px); border-radius: 20px; } }
.ph-top { display: flex; gap: 8px; align-items: center; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.ph-top select, .ph-top input { min-height: 36px; padding: 4px 8px; font-size: 14px; min-width: 0; }
.ph-top select { flex: 1; }
.ph-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y pinch-zoom; }
.ph-img { max-width: 100%; max-height: 100%; object-fit: contain; transition: filter .2s; }
.ph-img.soft { filter: blur(6px); }
.ph-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: none; border-radius: 12px; background: rgba(255, 255, 255, .15); color: #fff; font-size: 32px; cursor: pointer; }
.ph-nav.prev { left: 8px; }
.ph-nav.next { right: 8px; }
.ph-meta { background: var(--card); color: var(--ink); padding: 12px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.ph-meta textarea { width: 100%; }
.ph-share { background: var(--peach-tint); border-radius: 10px; padding: 8px 10px; }
.ph-meta input[type=checkbox] { width: 20px; height: 20px; flex: none; }

/* Trang bệnh nhân: ảnh to, bấm dễ */
.p-ph .ph-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ph-cap { color: #fff; padding: 10px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom)); font-size: 16px; }

/* Video bằng đường link (YouTube phát trong app, OneDrive mở tab mới) */
.vd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.vd-grid.sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.vd-tile { display: flex; flex-direction: column; gap: 2px; }
.vd-open { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }
.vd-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--soft); }
.vd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vd-play { position: absolute; inset: 0; margin: auto; width: 52px; height: 36px; border-radius: 10px; background: rgba(194, 24, 91, .9); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.vd-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--peach-dark); border: 1px dashed var(--line-2); }
.vd-ic { font-size: 28px; line-height: 1; }
.vd-title { font-weight: 600; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vd-sub { line-height: 1.35; }
.vd-tile .btn.link { align-self: flex-start; padding: 0; min-height: 28px; }
.vd-frame { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 0 max(8px, env(safe-area-inset-bottom)); }
.vd-frame iframe { width: 100%; aspect-ratio: 16 / 9; max-height: 100%; border: 0; background: #000; }
.vl-chip { display: inline-flex; align-items: center; gap: 6px; }
.vl-chip input { width: 16px; height: 16px; margin: 0; }
.vl-chip:has(input:checked) { background: var(--peach-tint); border-color: var(--peach); color: var(--peach-darker); font-weight: 600; }
.p-vd .vd-title { font-size: 16px; }
