/* Trang 2-5: menu trái chung + thanh trên mới; Trang 2 (Thêm ảnh) giao diện mới.
 * Giao diện 2026-10-16 theo mockup D:\big\orthonew-page2-mockup. Lớp mới có tiền tố p2-.
 * Trang 2 giữ nguyên id / lớp cũ (app.js gắn sự kiện theo đó): chỉ ghi đè kiểu, nên nhiều chỗ cần
 * !important để thắng style viết thẳng trong index.html. */

/* ---------------------------------------------------------------- khung chung Trang 2-5 */
body.p2-shell { background: #f5f8f8; }
body.p2-shell .main-container { padding: 0 8px 0 64px; }
body.p2-shell #subActionBar { display: none !important; } /* nút quay lại → "← Danh sách" + thanh bước */

/* Menu trái nằm ngoài Trang 1 (index.html #p1Rail): bù phần kiểu Trang 1 vốn kế thừa từ #dashboardStepContainer */
.p1-rail { font-family: 'Be Vietnam Pro', system-ui, sans-serif; }
.p1-rail, .p1-rail * { box-sizing: border-box; }
.p1-rail button { font-family: inherit; }
body.p2-shell .p1-rail:hover { z-index: 1100; } /* mở rộng khi rê chuột: nằm trên thanh trên (bình thường dưới hộp thoại) */

/* ---------------------------------------------------------------- thanh trên (Trang 2-5) */
#mainAppHeader.p2-header {
  --c0:#2563eb; --c0s:#eaf1ff; --c1:#7c3aed; --c1s:#f2edff; --c2:#d97706; --c2s:#fff4dc; --c3:#059669; --c3s:#e5f8ef;
  height: 52px; min-height: 52px; max-height: 52px; margin-left: 56px; padding: 0 16px 0 14px; gap: 14px;
  background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid #dfe8e9; box-shadow: none;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
}
#mainAppHeader.p2-header.hdr-fit-4 { height: auto; max-height: none; }
/* Tên bác sĩ / Đăng xuất / Quản lý AI / Telegram: đã có ở menu trái (Tài khoản) và Trang 1 */
.p2-header #userBadge, .p2-header #aiStatusBadge, .p2-header #linkAdminLearning, .p2-header #btnTelegramLink { display: none !important; }
.p2-header .header-left-cluster { gap: 10px; }
.p2-header .modern-medical-logo { width: 34px; height: 34px; border-radius: 10px; background: #fff; box-shadow: 0 4px 12px rgba(18,61,64,.12); overflow: hidden; }
.p2-header .modern-medical-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; display: block; }
.p2-back { height: 34px; border: 1px solid #dfe8e9; background: #fff; border-radius: 10px; padding: 0 12px 0 9px; display: inline-flex; align-items: center; gap: 6px;
  font: 700 13px 'Be Vietnam Pro', system-ui, sans-serif; color: #38505b; cursor: pointer; white-space: nowrap; }
.p2-back:hover { border-color: #9cc9c4; background: #f0fdfa; }

/* Thanh bước: 4 bước, cùng màu ô tiến độ Trang 1 */
.p2-header .compact-stepper { background: #f3f7f7; border: 1px solid #dfe8e9; border-radius: 999px; padding: 3px; gap: 0; }
.p2-header #step-pill-1, .p2-header .p2-line-first { display: none !important; }
.p2-header .stepper-pill { --c: var(--c0); --s: var(--c0s); height: 32px; padding: 0 13px 0 5px; border-radius: 999px; gap: 7px;
  font-size: 12.5px; font-weight: 700; color: #7b8d93; background: transparent; }
.p2-header #step-pill-3 { --c: var(--c1); --s: var(--c1s); }
.p2-header #step-pill-4 { --c: var(--c2); --s: var(--c2s); }
.p2-header #step-pill-5 { --c: var(--c3); --s: var(--c3s); }
.p2-header #step-pill-6 { --c: #0891b2; --s: #e0f6fb; } /* Phân tích mẫu (mã bước 6, đứng thứ 4) */
.p2-header .stepper-pill:hover { color: var(--c); background: transparent; transform: none; }
.p2-header .pill-dot { width: 22px; height: 22px; font-size: 11px; background: #fff; border: 1.5px solid #d3dfe0; color: #8a9a9f; }
.p2-header .stepper-pill.active { background: #fff; color: var(--c); box-shadow: 0 2px 8px rgba(20,60,70,.10), inset 0 0 0 1.5px var(--c); }
.p2-header .stepper-pill.active .pill-dot { background: var(--c); border-color: var(--c); color: #fff; }
.p2-header .stepper-pill.completed { color: var(--c); }
.p2-header .stepper-pill.completed .pill-dot { background: var(--s); border-color: var(--c); color: var(--c); }
.p2-header .stepper-line { width: 12px; height: 2px; background: #d6e2e3; border-radius: 2px; }

.p2-autosave { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: #0f766e; white-space: nowrap; margin-right: 4px; }
.p2-autosave i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px #dcfce7; }
.hdr-fit-2 .p2-autosave span, .hdr-fit-3 .p2-back span { display: none; }

/* Nút "bước tiếp" mang màu của bước kế */
.p2-header .btn-top-next { height: 38px; border-radius: 11px; padding: 0 14px 0 17px; font-size: 13.5px; font-weight: 800;
  background: linear-gradient(135deg,#7c3aed,#6d28d9); box-shadow: 0 8px 20px -6px rgba(124,58,237,.55); }
body[data-step="3"] .p2-header .btn-top-next { background: linear-gradient(135deg,#d97706,#b45309); box-shadow: 0 8px 20px -6px rgba(217,119,6,.55); }
body[data-step="4"] .p2-header .btn-top-next { background: linear-gradient(135deg,#0891b2,#0e7490); box-shadow: 0 8px 20px -6px rgba(8,145,178,.55); }
body[data-step="6"] .p2-header .btn-top-next { background: linear-gradient(135deg,#059669,#047857); box-shadow: 0 8px 20px -6px rgba(5,150,105,.55); }
.p2-header .btn-top-next:hover { filter: brightness(1.07); transform: none; }

/* ---------------------------------------------------------------- Trang 2: kích thước
 * Ô giữ đúng tỉ lệ chuẩn; chiều cao hàng = nhỏ hơn trong 2 giới hạn để luôn thấy đủ
 * ngoài mặt + trong miệng + mẫu hàm + X-quang: chiều cao màn hình chia 4, và chiều rộng đủ cho 5 ô 4:3. */
#overviewStepContainer.p2 {
  --line: #dfe8e9; --muted: #607580; --ink: #142b38; --t0: #f0fdfa; --t5: #14b8a6; --t6: #0d9488; --t7: #0f766e;
  --tray-w: 260px;
  --row-h: max(78px, min(calc((100vh - 272px) / 4), calc((100vw - 530px) * 0.148), 230px));
  color: var(--ink); font-family: 'Be Vietnam Pro', system-ui, sans-serif;
}
#overviewStepContainer.p2 [hidden] { display: none !important; }

/* dải bệnh nhân: 1 dòng (tối đa 2 dòng khi màn hẹp) */
.p2-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 42px; margin: 8px 0 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 5px 10px 5px 6px; }
.p2-pava { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden;
  font-weight: 800; font-size: 11px; color: #fff; background: linear-gradient(135deg,#14b8a6,#0f766e); }
.p2-pava img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.p2-strip h1 { font-size: 14.5px; margin: 0 2px; letter-spacing: -.01em; white-space: nowrap; font-weight: 800; color: var(--ink); }
.p2-strip h1.empty { color: #9aa8ac; font-weight: 700; }
.p2-code { font-family: Consolas, monospace; font-size: 10.5px; color: #284c55; font-weight: 700; background: #eff8f7; border: 1px solid #d9edeb; padding: 2px 7px; border-radius: 6px; }
.p2-tag { font-size: 11px; font-weight: 600; color: #48606a; background: #f3f6f6; border-radius: 6px; padding: 2px 7px; }
.p2-tag.f { color: #be185d; background: #fdf2f8; }
.p2-link { border: 0; background: none; color: var(--t7); font: 700 11.5px 'Be Vietnam Pro', system-ui, sans-serif; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.p2-link:hover { background: var(--t0); }
.p2-sp { flex: 1; }
.p2-gchips { display: flex; gap: 5px; flex-wrap: wrap; }
.p2-gchip { height: 26px; border: 1px solid #e3ecec; background: #fbfdfd; border-radius: 8px; padding: 0 8px; font: 600 11px 'Be Vietnam Pro', system-ui, sans-serif; color: #6b7f86; cursor: pointer; white-space: nowrap; }
.p2-gchip b { color: #1f3a44; margin-left: 2px; }
.p2-gchip:hover { border-color: #9cc9c4; }
.p2-gchip.full { border-color: #a7f3d0; background: #f6fffb; } .p2-gchip.full b { color: #047857; }
.p2-prog { display: flex; align-items: center; gap: 8px; margin-left: 6px; }
.p2-prog strong { font-size: 13px; min-width: 40px; text-align: right; }
.p2-track { width: 110px; height: 6px; background: #e8eeee; border-radius: 99px; overflow: hidden; }
.p2-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg,var(--t5),var(--t6)); border-radius: 99px; transition: width .35s; }

/* bố cục: ảnh trái + khay phải */
.p2 .mockup-workbench-layout { max-width: none; padding: 0 0 24px; gap: 10px; }

/* nạp ảnh: 1 dòng cao bằng nút Drive */
.p2-import { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 8px; }
.p2 #bulkDropZone.p2-drop { height: 38px; margin: 0; padding: 0 14px; border: 1.5px dashed #9fd6cf; background: #f6fdfc; border-radius: 11px;
  display: flex; align-items: center; gap: 10px; cursor: pointer; white-space: nowrap; overflow: hidden; color: var(--t6); box-shadow: none; transform: none; }
.p2 #bulkDropZone.p2-drop:hover, .p2 #bulkDropZone.p2-drop.drag-over { border-color: var(--t6); background: #e6f8f5; }
.p2-drop svg { flex: 0 0 auto; }
.p2-drop strong { font-size: 13px; color: #0f3d3a; font-weight: 800; }
.p2-drop small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.p2-btn2 { height: 38px; border-radius: 11px; padding: 0 13px; border: 1px solid var(--line, #dfe8e9); background: #fff; color: #38505b; display: inline-flex; align-items: center; gap: 8px;
  font: 700 12.5px 'Be Vietnam Pro', system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.p2-btn2:hover { border-color: #9cc9c4; background: #f0fdfa; }
.p2-btn2.on { border-color: #0d9488; background: #f0fdfa; color: #0f766e; }
.p2-gd { width: 17px; height: 15px; flex: 0 0 auto; }
.p2-primary { height: 38px; border: 0; border-radius: 11px; padding: 0 16px; background: linear-gradient(135deg,#0d9488,#0f766e); color: #fff;
  font: 800 13px 'Be Vietnam Pro', system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.p2-primary:hover { filter: brightness(1.07); }
.p2-primary:disabled { opacity: .5; cursor: default; }

/* ô dán link Drive (mở bằng nút "Lấy từ Drive") */
.p2-drive { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin-bottom: 8px; }
.p2-drive-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.p2-drive-row input { flex: 1; min-width: 240px; height: 38px; border: 1.5px solid #d3dfe0; border-radius: 10px; padding: 0 12px; font: 13px 'Be Vietnam Pro', system-ui, sans-serif; outline: none; box-sizing: border-box; }
.p2-drive-row input:focus { border-color: #0d9488; box-shadow: 0 0 0 4px rgba(13,148,136,.1); }
.p2-two-line { gap: 9px; padding: 0 14px 0 11px; text-align: left; }
.p2-two-line span { display: flex; flex-direction: column; line-height: 1.2; }
.p2-two-line strong { font-size: 12.5px; color: #1f3a44; }
.p2-two-line small { font-size: 10.5px; font-weight: 500; color: var(--muted); }
.p2-drive #gdriveHint { font-size: 11px !important; color: var(--muted) !important; margin-top: 6px !important; }

/* ---------------------------------------------------------------- Trang 2: nhóm ảnh
 * Tên nhóm / số ảnh / Tải ảnh / Về khay / Xóa nhóm ở cột trái; các hàng sát nhau */
.p2 .section-container { display: flex; gap: 8px; align-items: stretch; background: #fff !important; border: 1px solid var(--line) !important;
  border-radius: 10px !important; padding: 5px !important; margin: 0 0 5px !important; box-shadow: none !important; }
.p2 .section-header { width: 104px; flex: 0 0 auto; display: flex !important; flex-direction: column !important; align-items: flex-start !important;
  justify-content: flex-start !important; gap: 2px; padding: 3px 4px 0 4px !important; margin: 0 !important; border: 0 !important; border-right: 1px solid #eef3f3 !important; }
.p2 .section-title { display: contents !important; }
.p2 .section-title .section-badge { display: none !important; }
.p2 .p2-gtitle { order: 1; font-size: 12px; font-weight: 800; line-height: 1.25; color: var(--ink); }
.p2 .section-header > span[id^="badgeCount"] { order: 2; font-size: 11px !important; font-weight: 700 !important; color: var(--muted) !important;
  background: #f3f6f6; border-radius: 6px; padding: 1px 6px; margin-bottom: 4px; }
.p2 .section-header > span[id^="badgeCount"].p2-full { color: #047857 !important; background: #ecfdf5; }
.p2 .btn-category-upload { order: 3; margin-top: auto; }
.p2 .btn-category-clear { order: 4; }
.p2 .btn-category-delete { order: 5; }
.p2 .btn-category-upload, .p2 .btn-category-clear, .p2 .btn-category-delete {
  height: 20px; display: inline-flex !important; align-items: center; gap: 4px !important; padding: 0 5px !important; border: 1px solid transparent !important;
  background: transparent !important; border-radius: 6px !important; font: 700 10.5px 'Be Vietnam Pro', system-ui, sans-serif !important; color: #6b7f86 !important;
  cursor: pointer; box-shadow: none !important; }
.p2 .btn-category-upload::before { content: ''; width: 13px; height: 13px; flex: 0 0 auto;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='M17 8l-5-5-5 5M12 3v12'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='M17 8l-5-5-5 5M12 3v12'/%3E%3C/svg%3E") center/contain no-repeat; }
.p2 .btn-category-upload:hover, .p2 .btn-category-clear:hover { background: #f1f6f6 !important; border-color: var(--line) !important; color: #38505b !important; }
.p2 .btn-category-clear:hover { background: #fff7ed !important; border-color: #fed7aa !important; color: #c2410c !important; }
.p2 .btn-category-delete { color: #dc2626 !important; }
.p2 .btn-category-delete:hover { background: #fef2f2 !important; border-color: #fecaca !important; color: #b91c1c !important; }
.p2 .btn-category-upload svg, .p2 .btn-category-clear svg, .p2 .btn-category-delete svg { width: 13px; height: 13px; }

/* lưới ô: hàng ngang, ô rộng theo tỉ lệ chuẩn */
.p2 .photo-card-grid { display: flex !important; flex-wrap: wrap; gap: 5px !important; align-content: flex-start; flex: 1; min-width: 0; grid-template-columns: none !important; }

/* tỉ lệ chuẩn: ngoài mặt 3:4 đứng, trong miệng / mẫu hàm / bổ sung 4:3, pano 2:1, ceph 5:4, PA 4:5 */
.p2 .photo-slot { position: relative; flex: 0 0 auto; height: var(--row-h); aspect-ratio: 4 / 3; margin: 0; border: 1.5px dashed #cfdcdd; border-radius: 8px;
  background: #fff; box-shadow: none; overflow: hidden; display: block; cursor: pointer; }
.p2 .photo-slot[data-slot-id^="extra_"] { aspect-ratio: 3 / 4; }
.p2 .photo-slot[data-slot-id="rad_pano"] { aspect-ratio: 2 / 1; }
.p2 .photo-slot[data-slot-id="rad_ceph"] { aspect-ratio: 5 / 4; }
.p2 .photo-slot[data-slot-id="rad_pa"] { aspect-ratio: 4 / 5; }
.p2 .photo-slot[data-slot-id^="other_"] { height: calc(var(--row-h) * .8); } /* 6 ô bổ sung vừa 1 hàng */
.p2 .photo-slot:hover { border-color: #8fcfc7; transform: none; box-shadow: none; }
.p2 .photo-slot.filled { border-style: solid; border-color: #d6e4e4; }
.p2 .photo-slot.drag-over, .p2 .photo-slot.drag-target { border: 1.5px solid #0d9488 !important; outline: none; box-shadow: 0 0 0 3px rgba(13,148,136,.22) !important; }
.p2 .swap-target-candidate:hover { transform: none; }

.p2 .slot-body { position: absolute; inset: 0; height: 100% !important; background: #fff; }
.p2 .photo-slot.filled .slot-body { background: #0b1416; }
.p2 .slot-illustration-container { background: #fff; }
.p2 .slot-illustration-img { opacity: .4; padding-bottom: 16px; box-sizing: border-box; }
.p2 .photo-slot:hover .slot-illustration-img { transform: none; opacity: .55; }
.p2 .slot-empty-prompt { display: none; }
.p2 .slot-placeholder-other { margin: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: #fff; padding-bottom: 14px; }
/* ảnh: lấp đầy ô (phim: thấy trọn phim); ảnh xoay 90° thì giữ trọn ảnh */
.p2 .slot-image { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.p2 .slot-image[style*="rotate(90deg)"], .p2 .slot-image[style*="rotate(270deg)"],
.p2 .photo-slot[data-slot-id^="rad_"] .slot-image { object-fit: contain; }

/* tên ô nằm đè đáy ảnh, không chiếm thêm dòng */
.p2 .slot-header { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding: 3px 6px; border: 0; background: rgba(255,255,255,.9);
  font-size: 10.5px; font-weight: 700; color: #4b636c; display: flex; gap: 4px; white-space: nowrap; overflow: hidden; pointer-events: none; justify-content: flex-start; }
.p2 .slot-header > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.p2 .photo-slot.filled .slot-header { color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.62)); padding-top: 12px; }
.p2 .photo-slot.filled .slot-header::after { content: ''; margin-left: auto; width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto;
  background: #10b981 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L19 8'/%3E%3C/svg%3E") center/10px no-repeat; }
.p2 .slot-optional-tag { display: none; } /* thay bằng nhãn "tùy chọn" góc trên ô trống */
.p2 .photo-slot:not(.filled)[data-slot-id="rad_pa"]::before, .p2 .photo-slot:not(.filled)[data-slot-id^="other_"]::before {
  content: 'tùy chọn'; position: absolute; top: 4px; left: 4px; z-index: 6; font-size: 9px; font-weight: 700; color: #8a9a9f;
  background: #fff; border: 1px solid #e3ecec; border-radius: 5px; padding: 1px 5px; pointer-events: none; }

/* 4 nút trên ảnh: cột dọc nhỏ sát mép phải (không che ảnh hẹp 3:4) */
.p2 .slot-hover-trash-topright { display: none !important; }
.p2 .slot-hover-controls { left: auto; right: 3px; top: 3px; bottom: auto; padding: 0; background: none; flex-direction: column; gap: 2px; transform: none; z-index: 8; }
.p2 .photo-slot.filled:hover .slot-hover-controls { transform: none; }
.p2 .slot-mini-btn { width: 20px; height: 20px; padding: 0; justify-content: center; font-size: 0; gap: 0; border-radius: 6px; border: 0;
  background: rgba(255,255,255,.94); color: #38505b; box-shadow: 0 2px 6px rgba(0,0,0,.18); backdrop-filter: none; }
.p2 .slot-mini-btn svg { width: 12px; height: 12px; }
.p2 .slot-mini-btn:hover { background: #fff; color: #0f766e; transform: none; }
.p2 .slot-mini-btn-return:hover { background: #fff7ed !important; color: #c2410c !important; border: 0 !important; }
.p2 .slot-mini-btn-delete:hover { background: #fef2f2 !important; color: #dc2626 !important; border: 0 !important; }
.p2 .swap-selected-badge { top: 3px; left: 3px; right: auto; font-size: 10px; padding: 2px 6px; white-space: nowrap; max-width: calc(100% - 30px); overflow: hidden; }

/* ---------------------------------------------------------------- Trang 2: khay chờ (cột phải) */
.p2 .mockup-right-tray.p2-tray { width: var(--tray-w); top: calc(var(--hdr-h, 52px) + 8px); max-height: calc(100vh - var(--hdr-h, 52px) - 16px);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: none; padding: 8px; gap: 6px; overflow: hidden; }
.p2-tray-head { display: flex; align-items: center; gap: 6px; height: 26px; flex-shrink: 0; }
.p2-tray-head strong { font-size: 12.5px; font-weight: 800; color: var(--ink); }
.p2-tray .tray-counter-pill { font-size: 11px; padding: 1px 7px; }
.p2-tray-add { margin-left: auto; width: 26px; height: 26px; border: 1px dashed #9fd6cf; background: #f6fdfc; color: #0f766e; border-radius: 7px; display: grid; place-items: center; cursor: pointer; }
.p2-tray-add:hover { background: #e6f8f5; }
.p2-tray-all { height: 30px; flex-shrink: 0; border: 1px solid var(--line); background: #fff; color: #4b636c; border-radius: 8px;
  font: 700 11.5px 'Be Vietnam Pro', system-ui, sans-serif; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.p2-tray-all:hover { border-color: #fdba74; background: #fff7ed; color: #c2410c; }
.p2-tray .tray-photo-stream { padding: 0; gap: 5px; background: transparent; min-height: 80px; }
.p2-tray .tray-card-thumb { height: 110px; }
.p2-tray .tray-empty-box { padding: 14px 4px; }
.p2-tray .tray-empty-icon svg { width: 28px; height: 28px; }
.p2-tray-foot { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.p2-tray .tray-clean-all-btn { height: 28px; justify-content: center; border: 0; background: transparent; font-size: 11.5px; border-radius: 8px; }
.p2-tray .tray-clean-all-btn:hover { background: #fff1f0; }
.p2-wipe { height: 34px; border: 0; background: #dc2626; color: #fff; border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 6px;
  font: 800 12px 'Be Vietnam Pro', system-ui, sans-serif; cursor: pointer; box-shadow: 0 4px 12px -4px rgba(220,38,38,.5); }
.p2-wipe:hover { background: #b91c1c; }

/* ---------------------------------------------------------------- hộp sửa thông tin bệnh nhân */
.p2-modal-bg { position: fixed; inset: 0; z-index: 10050; background: rgba(6,30,32,.55); display: grid; place-items: center; padding: 24px; font-family: 'Be Vietnam Pro', system-ui, sans-serif; }
.p2-modal-bg[hidden] { display: none; }
.p2-modal { background: #fff; border-radius: 22px; width: min(520px, 100%); padding: 22px; box-shadow: 0 18px 48px rgba(19,59,62,.18); color: #142b38; }
.p2-modal header { display: flex; justify-content: space-between; gap: 12px; }
.p2-kicker { font-size: 10px; font-weight: 800; letter-spacing: .12em; color: #0d9488; }
.p2-modal h2 { margin: 4px 0 0; font-size: 20px; }
.p2-x { width: 34px; height: 34px; border: 1px solid #dfe8e9; background: #fff; border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: #4b636c; }
.p2-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.p2-form .full { grid-column: 1 / -1; }
.p2-form label, .p2-lbl { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: #38505b; }
.p2-form label small { font-weight: 500; color: #8a9a9f; display: inline; }
.p2-form input { height: 44px; border: 1.5px solid #d3dfe0; border-radius: 11px; padding: 0 12px; font: 14px 'Be Vietnam Pro', system-ui, sans-serif; outline: none; box-sizing: border-box; }
.p2-form input:focus { border-color: #0d9488; box-shadow: 0 0 0 4px rgba(13,148,136,.1); }
.p2-datewrap { position: relative; display: block; }
.p2-datewrap #p2PmDob { width: 100%; padding-right: 42px; }
.p2-datewrap input[type=date] { position: absolute; right: 0; top: 0; width: 44px; height: 44px; opacity: 0; cursor: pointer; z-index: 2; border: 0; padding: 0; }
.p2-datewrap svg { position: absolute; right: 13px; top: 13px; width: 18px; height: 18px; fill: none; stroke: #789096; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.p2-form #p2PmCode { font-family: Consolas, monospace; font-weight: 800; letter-spacing: .06em; color: #0f625d; background: #effaf8; }
.p2-gsw { display: flex; gap: 8px; margin-top: 6px; }
.p2-gsw button { flex: 1; height: 40px; border: 1.5px solid #d3dfe0; background: #fff; border-radius: 11px; font: 700 13px 'Be Vietnam Pro', system-ui, sans-serif; color: #4b636c; cursor: pointer; }
.p2-gsw button.active { border-color: #0d9488; background: #f0fdfa; color: #0f766e; }
.p2-hintline { font-size: 11.5px; color: #607580; }
.p2-err { color: #dc2626; font-weight: 700; }
.p2-form footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.p2-text { border: 0; background: none; font: 700 13px 'Be Vietnam Pro', system-ui, sans-serif; color: #4b636c; cursor: pointer; padding: 0 14px; }

/* ---------------------------------------------------------------- màn hẹp */
@media (max-width: 1280px) {
  .p2-drop small { display: none; }
}
@media (max-width: 980px) {
  #overviewStepContainer.p2 { --row-h: 110px; }
  .p2 .mockup-workbench-layout { flex-direction: column; }
  .p2 .mockup-right-tray.p2-tray { position: static; width: 100%; max-height: none; order: -1; }
  .p2 .section-container { flex-direction: column; }
  .p2 .section-header { width: auto; flex-direction: row !important; flex-wrap: wrap; align-items: center !important; border-right: 0 !important; }
  .p2 .btn-category-upload { margin-top: 0; }
}
@media (max-width: 640px) {
  body.p2-shell .p1-rail { display: none; }
  body.p2-shell .main-container { padding-left: 8px; }
  #mainAppHeader.p2-header { margin-left: 0; }
}

/* 2026-10-24: ô mã QR tải ảnh của ca ở đầu Khay chờ (js/p2_qr.js) */
.p2-qrtile { display: flex; align-items: center; gap: 10px; width: calc(100% - 4px); margin: 0 2px 10px; padding: 8px 10px; border: 1.5px dashed #14b8a6; border-radius: 12px; background: #f0fdfa; cursor: pointer; text-align: left; font: inherit; color: #134e4a; }
.p2-qrtile[hidden] { display: none !important; }
.p2-qrtile:hover { background: #ccfbf1; border-style: solid; }
.p2-qrtile-img { flex: 0 0 72px; width: 72px; height: 72px; display: grid; place-items: center; background: #fff; border-radius: 8px; overflow: hidden; }
.p2-qrtile-img svg { width: 72px; height: 72px; }
.p2-qrtile-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.p2-qrtile-copy strong { font-size: 12.5px; }
.p2-qrtile-copy small { font-size: 10.5px; color: #4b6b68; line-height: 1.35; }

/* 2026-10-29: nhãn NGHỈ / CƯỜI ở đầu 6 ô ngoài mặt (dưới ô chỉ còn hướng chụp: "3. 45°") */
.p2 .p2-mood { position: absolute; top: 5px; left: 5px; z-index: 7; padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 800;
  letter-spacing: .04em; line-height: 1.4; pointer-events: none; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.p2 .p2-mood.rest { background: #0f766e; color: #fff; }
.p2 .p2-mood.smile { background: #f59e0b; color: #3b2300; }
.p2 .photo-slot[data-slot-id^="extra_"] .slot-header { justify-content: center; font-weight: 800; padding-left: 2px; padding-right: 2px; letter-spacing: -.01em; }

/* ca chưa có ảnh: viền nét đứt chạy quanh ô kéo thả (marching ants) cho dễ thấy chỗ thêm ảnh */
.p2 #bulkDropZone.p2-drop.p2-drop-hint { border-color: transparent; background-color: #f0fbf9;
  background-image: linear-gradient(90deg, var(--t6, #0d9488) 50%, transparent 50%), linear-gradient(90deg, var(--t6, #0d9488) 50%, transparent 50%),
    linear-gradient(0deg, var(--t6, #0d9488) 50%, transparent 50%), linear-gradient(0deg, var(--t6, #0d9488) 50%, transparent 50%);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y; background-size: 14px 2px, 14px 2px, 2px 14px, 2px 14px;
  background-position: 0 0, 0 100%, 0 0, 100% 0; animation: p2-ants .9s linear infinite, p2-glow 1.8s ease-in-out infinite; }
@keyframes p2-ants { to { background-position: 14px 0, -14px 100%, 0 -14px, 100% 14px; } }
@keyframes p2-glow { 50% { box-shadow: 0 0 0 4px rgba(13,148,136,.16); } }
@media (prefers-reduced-motion: reduce) { .p2 #bulkDropZone.p2-drop.p2-drop-hint { animation: none; border: 2px dashed var(--t6, #0d9488); } }