/* Doctor pages and patient files (Decision Twin). Scoped under .pf; follows the app theme. */
.pf {
  --pf-ink: var(--text); --pf-muted: var(--text-2); --pf-line: var(--border); --pf-surface: var(--surface);
  --pf-raised: var(--surface-2); --pf-primary: #152033; --pf-on-primary: #ffffff;
  --pf-iris: #3d4fc4; --pf-iris-soft: #eef0fb; --pf-on-iris: #ffffff; --pf-mid: #a9b3cf; --pf-ring2: #a7b4ff;
  --pf-loss: #e8664a; --pf-loss-soft: #fdeeea; --pf-loss-ink: #b8452c; --pf-glow: rgba(61, 79, 196, 0.10);
  display: flex; flex-direction: column; gap: 24px; color: var(--pf-ink); padding-bottom: 48px;
}
:root[data-theme="dark"] .pf {
  --pf-primary: #e7ebf2; --pf-on-primary: #0e131d; --pf-iris: #8c9bff; --pf-iris-soft: rgba(140, 155, 255, 0.12);
  --pf-on-iris: #0e131d; --pf-mid: #4a5677; --pf-ring2: #c3cbff; --pf-loss: #ff8466; --pf-loss-soft: rgba(255, 132, 102, 0.13);
  --pf-loss-ink: #ff957a; --pf-glow: rgba(140, 155, 255, 0.16);
}
.pf-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--pf-line); }
.pf-bar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.pf-bar nav a { padding: 7px 12px; border-radius: 8px; color: var(--pf-muted); font-size: 13px; text-decoration: none; }
.pf-bar nav a:hover { background: var(--pf-raised); color: var(--pf-ink); }
.pf-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; color: var(--pf-muted); }
.pf-card { background: var(--pf-surface); border: 1px solid var(--pf-line); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pf-hero { background: radial-gradient(760px 320px at 92% -30%, var(--pf-glow), transparent 70%), var(--pf-surface); border-radius: 24px; padding: 30px; }
.pf-row { display: flex; flex-wrap: wrap; gap: 16px; }
.pf-row > .wide { flex: 1.6 1 460px; min-width: 0; }
.pf-row > .narrow { flex: 1 1 300px; min-width: 0; }
.pf-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; }
.pf-sec { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: 90px; }
.pf-sec > header h2 { margin: 0; font-size: 20px; font-weight: 700; }
.pf-sec > header p { margin: 4px 0 0; font-size: 14px; color: var(--pf-muted); }
.pf-h3 { font-size: 16px; font-weight: 700; }
.pf-note { font-size: 13px; color: var(--pf-muted); line-height: 1.85; }
.pf-box { font-size: 13px; color: var(--pf-muted); line-height: 1.85; padding: 12px 14px; border-radius: 12px; background: var(--pf-raised); }
.pf-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--pf-raised); color: var(--pf-muted); white-space: nowrap; }
.pf-chip.iris { background: var(--pf-iris-soft); color: var(--pf-iris); }
.pf-chip.loss { background: var(--pf-loss-soft); color: var(--pf-loss-ink); }
.pf-chip.big { font-size: 13px; padding: 5px 12px; }
.pf-btn { height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--pf-line); background: var(--pf-surface); color: var(--pf-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; transition: background-color .18s, border-color .18s, transform .12s; }
.pf-btn:hover { background: var(--pf-raised); }
.pf-btn:active { transform: translateY(1px); }
.pf-btn.sm { height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13px; }
.pf-btn.primary { background: var(--pf-primary); color: var(--pf-on-primary); border-color: var(--pf-primary); font-weight: 700; }
.pf-btn.on { background: var(--pf-iris); color: var(--pf-on-iris); border-color: var(--pf-iris); }
.pf-btn:focus-visible, .pf a:focus-visible { outline: 2px solid var(--pf-iris); outline-offset: 3px; }
.pf-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); background: var(--pf-surface); border: 1px solid var(--pf-line); border-radius: 20px; overflow: hidden; }
.pf-kpis > div { padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; min-width: 0; border-inline-start: 1px solid var(--pf-line); margin-inline-start: -1px; }
.pf-kpi-v { font-size: 32px; font-weight: 600; line-height: 1.1; }
.pf-big { font-size: 40px; font-weight: 700; line-height: 1.15; }
.pf-avatar { flex: none; border-radius: 50%; padding: 3px; box-sizing: border-box; background: conic-gradient(from 210deg, var(--pf-iris), var(--pf-ring2), var(--pf-iris)); }
.pf-avatar > div { width: 100%; height: 100%; border-radius: 50%; background: var(--pf-raised); border: 3px solid var(--pf-surface); box-sizing: border-box; display: grid; place-items: center; overflow: hidden; color: var(--pf-iris); font-weight: 800; }
.pf-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pf-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; margin-top: 11px; }
.pf-list-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--pf-line); }
.pf-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--pf-raised); border: 1px solid var(--pf-line); }
.pf-seg button { height: 32px; padding: 0 14px; border-radius: 8px; border: 0; background: transparent; color: var(--pf-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.pf-seg button[aria-pressed="true"] { background: var(--pf-surface); color: var(--pf-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.pf-heat { display: grid; gap: 5px; }
.pf-heat span.c { height: 28px; border-radius: 6px; }
.pf-bars { position: relative; height: 190px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; align-items: end; }
.pf-bars .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.pf-bars .b { display: block; width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; transform-origin: bottom; animation: pfGrow .8s cubic-bezier(.2,.7,.2,1) both; transition: height .55s cubic-bezier(.2,.7,.2,1); }
.pf-avg { position: absolute; inset-inline: 0; z-index: 1; border-top: 1.5px dashed var(--pf-muted); opacity: .7; transition: bottom .55s cubic-bezier(.2,.7,.2,1); }
.pf-track { position: relative; height: 12px; border-radius: 999px; background: var(--pf-raised); }
.pf-fill { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; border-radius: 999px; transform-origin: right; animation: pfGrowX .9s cubic-bezier(.2,.7,.2,1) .2s both; }
[dir="ltr"] .pf-fill { transform-origin: left; }
.pf-stack { display: flex; height: 12px; border-radius: 999px; overflow: hidden; gap: 2px; }
.pf-stack > span { transform-origin: right; animation: pfGrowX .9s cubic-bezier(.2,.7,.2,1) .2s both; }
.pf-tl { display: grid; grid-template-columns: 96px 22px minmax(0, 1fr); gap: 0 12px; min-height: 60px; }
.pf-tl .rail { position: relative; display: flex; justify-content: center; }
.pf-tl .rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--pf-line); }
.pf-tl .node { position: relative; z-index: 1; margin-top: 5px; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; }
.pf-next { position: relative; overflow: hidden; }
.pf-next::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--pf-loss); }
.pf-pulse { animation: pfRing 2.4s ease-out infinite; }
.pf-tooth-active { animation: pfBlink 2.4s ease-in-out infinite; }
.pf-in { animation: pfRise .6s cubic-bezier(.2,.7,.2,1) both; }
.pf-draw { stroke-dasharray: 100; animation: pfDraw 1.1s cubic-bezier(.65,0,.35,1) both; }
.pf-pop { transform-box: fill-box; transform-origin: center; animation: pfPop .9s cubic-bezier(.2,.7,.2,1) .25s both; }
.pf-fade { animation: pfFade .5s ease both; }
.pf-dir { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pf-dir a { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; border: 1px solid var(--pf-line); background: var(--pf-surface); color: var(--pf-ink); text-decoration: none; transition: border-color .18s, transform .12s; }
.pf-dir a:hover { border-color: var(--pf-iris); }
.pf-input { height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--pf-line); background: var(--pf-surface); color: var(--pf-ink); font: inherit; font-size: 15px; min-width: 0; }
@keyframes pfRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pfDraw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes pfPop { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }
@keyframes pfFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pfGrow { from { transform: scaleY(0); } to { transform: none; } }
@keyframes pfGrowX { from { transform: scaleX(0); } to { transform: none; } }
@keyframes pfBlink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes pfRing { 0% { box-shadow: 0 0 0 0 rgba(232, 102, 74, .45); } 100% { box-shadow: 0 0 0 12px rgba(232, 102, 74, 0); } }
@media (prefers-reduced-motion: reduce) {
  .pf-in, .pf-draw, .pf-pop, .pf-fade, .pf-bars .b, .pf-fill, .pf-stack > span, .pf-pulse, .pf-tooth-active { animation: none; }
  .pf-bars .b, .pf-avg, .pf-btn { transition: none; }
}
@media print { .pf-bar nav, .pf-btn { display: none; } }
/* tooth chart motion */
.tc-tooth { transform-box: view-box; transition: transform .55s cubic-bezier(.34,1.56,.64,1), opacity .3s ease; }
.tc-tooth.tc-up.sel { transform: translateY(8px) scale(1.08); }
.tc-tooth.tc-down.sel { transform: translateY(-8px) scale(1.08); }
.tc-tooth.tc-up.hov:not(.sel) { transform: translateY(3px); }
.tc-tooth.tc-down.hov:not(.sel) { transform: translateY(-3px); }
.tc-chart.has-sel .tc-tooth:not(.sel) { opacity: .55; }
.tc-hit { cursor: pointer; outline: none; }
.tc-hit:focus-visible .tc-label text { text-decoration: underline; }
.tc-label { transition: transform .4s cubic-bezier(.34,1.56,.64,1); }
.tc-label.sel text { font-weight: 800; }
.tc-ripple { transform-box: fill-box; transform-origin: center; animation: tcRipple .85s cubic-bezier(.2,.7,.2,1) both; }
.tc-zoom { animation: tcPop .65s cubic-bezier(.34,1.56,.64,1) both; transform-origin: 50% 60%; }
.tc-late { animation: pfFade .5s ease .45s both; }
.tc-screw { animation: tcScrew .9s cubic-bezier(.2,.7,.2,1) .15s both; }
.tc-detail > * { animation: pfRise .45s cubic-bezier(.2,.7,.2,1) both; }
.tc-detail > *:nth-child(2) { animation-delay: .06s; } .tc-detail > *:nth-child(3) { animation-delay: .12s; }
.tc-detail > *:nth-child(4) { animation-delay: .18s; } .tc-detail > *:nth-child(5) { animation-delay: .24s; }
@keyframes tcRipple { from { transform: scale(.45); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@keyframes tcPop { from { transform: scale(.55) translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tcScrew { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .tc-tooth, .tc-label { transition: none; }
  .tc-ripple, .tc-zoom, .tc-late, .tc-screw, .tc-detail > * { animation: none; }
}
.pf { --pf-gumA: #f4b6b4; --pf-gumB: #e48f92; --pf-ghost: #a9b3cf; --pf-ti-edge: #7d8794; --pf-edge: #b9ad95; --pf-root-edge: #c7b28e; }
:root[data-theme="dark"] .pf { --pf-gumA: #b9646f; --pf-gumB: #8f4553; --pf-ghost: #5b6680; --pf-ti-edge: #6b7480; --pf-edge: #9a8f7b; --pf-root-edge: #8a7a60; }
/* list rows (doctors, patients) */
.pf-list { overflow: hidden; }
.pf-lrow { display: grid; grid-template-columns: minmax(230px, 2.2fr) minmax(70px, .8fr) minmax(70px, .8fr) minmax(80px, .9fr) minmax(130px, 1.2fr) minmax(60px, .7fr) 24px; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--pf-line); color: var(--pf-ink); text-decoration: none; transition: background-color .15s ease; animation: pfRise .4s cubic-bezier(.2,.7,.2,1) both; }
.pf-lrow.pt { grid-template-columns: minmax(200px, 1.6fr) minmax(160px, 1.6fr) minmax(130px, 1.1fr) minmax(70px, .7fr) 24px; }
.pf-lrow:first-child { border-top: 0; }
.pf-lrow.head { padding-block: 10px; background: var(--pf-raised); font-size: 12px; color: var(--pf-muted); font-weight: 600; animation: none; }
a.pf-lrow:hover { background: var(--pf-raised); }
a.pf-lrow:hover .go { color: var(--pf-iris); transform: translateX(-3px); }
[dir="ltr"] a.pf-lrow:hover .go { transform: translateX(3px) scaleX(-1); }
[dir="ltr"] .pf-lrow .go svg { transform: scaleX(-1); }
.pf-lrow .who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pf-lrow .nm { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pf-lrow .nm b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-lrow .nm .pf-note { font-size: 12px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-lrow .c { text-align: center; font-size: 14px; }
.pf-lrow .go { color: var(--pf-muted); display: grid; place-items: center; transition: transform .2s ease, color .2s ease; }
.pf-dotn { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
@media (max-width: 760px) {
  .pf-lrow, .pf-lrow.pt { grid-template-columns: minmax(0, 1fr) auto 20px; padding-inline: 14px; }
  .pf-lrow .opt { display: none; }
}
@media (prefers-reduced-motion: reduce) { .pf-lrow { animation: none; transition: none; } }

/* ---------------------------------------------------------------- patient pictures (imaging) */
.pf { --pi-box: #0b1020; --pi-box-2: #141b31; --pi-box-line: rgba(160, 175, 230, 0.16); --pi-on-box: #e9edf8; --pi-on-box-2: #9aa5c4; }
.pi-img { position: relative; display: grid; place-items: center; overflow: hidden; background: #05070d; color: #5b6685; }
.pi-img img { width: 100%; height: 100%; object-fit: contain; display: block; animation: pfFade .35s ease both; user-select: none; }
.pi-img.loading::after, .pi-img.idle::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(150, 165, 220, 0.10) 50%, transparent 80%); background-size: 220% 100%; animation: piShimmer 1.4s linear infinite; }
@keyframes piShimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.pi-locks { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--pf-muted); line-height: 1.8; }
.pi-locks svg { flex: none; color: var(--pf-iris); margin-top: 5px; }
.pi-lightbox { background: radial-gradient(900px 260px at 50% -40%, rgba(140, 155, 255, 0.16), transparent 70%), var(--pi-box); border: 1px solid var(--pi-box-line); border-radius: 18px; padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 12px; color: var(--pi-on-box); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.pi-lbh { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--pi-on-box); }
.pi-count { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: rgba(140, 155, 255, 0.16); color: #c3cbff; }
.pi-empty { font-size: 13px; color: var(--pi-on-box-2); padding: 8px 2px; }
.pi-strip { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: #2a3352 transparent; }
.pi-opgcard { flex: none; width: min(460px, 82vw); scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: zoom-in; text-align: start; }
.pi-opg { width: 100%; aspect-ratio: 2.12; border-radius: 12px; border: 1px solid var(--pi-box-line); transition: border-color .18s, box-shadow .18s; }
.pi-opgcard:hover .pi-opg, .pi-opgcard:focus-visible .pi-opg { border-color: rgba(167, 180, 255, 0.7); box-shadow: 0 0 0 4px rgba(140, 155, 255, 0.14); }
.pi-opgcard:focus-visible { outline: none; }
.pi-loading .pi-opg { flex: none; width: min(460px, 82vw); }
.pi-loading { display: flex; flex-direction: column; gap: 10px; }
.pi-cap { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--pi-on-box); }
.pi-new { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #c3cbff; color: #0b1020; }
.pi-days { display: flex; flex-direction: column; gap: 16px; }
.pi-day { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--pf-line); }
.pi-day:first-child { border-top: 0; padding-top: 2px; }
.pi-dayh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; font-size: 14px; }
.pi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.pi-tile { position: relative; padding: 0; border: 1px solid var(--pf-line); border-radius: 12px; overflow: hidden; background: #05070d; cursor: zoom-in; aspect-ratio: 4 / 3; transition: transform .16s, border-color .16s, box-shadow .16s; }
.pi-tile .pi-img { width: 100%; height: 100%; }
.pi-tile:hover, .pi-tile:focus-visible { border-color: var(--pf-iris); box-shadow: 0 0 0 3px var(--pf-glow); transform: translateY(-1px); outline: none; }
.pi-tile.check { border-color: color-mix(in srgb, var(--pf-loss) 55%, var(--pf-line)); }
.pi-why { position: absolute; inset-inline: 6px; bottom: 6px; font-size: 11px; font-weight: 600; line-height: 1.5; padding: 3px 7px; border-radius: 7px; background: rgba(10, 12, 20, 0.82); color: #ffc2b2; text-align: start; }
.pi-check { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--pf-loss-soft); }
.pi-checkh { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 14px; color: var(--pf-ink); }
.pi-checki { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--pf-loss); color: #fff; font-weight: 800; font-size: 14px; }
.pi-warn { background: var(--pf-loss-soft); color: var(--pf-loss-ink); font-weight: 600; }
.pi-tooth { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pi-tooth-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.pi-count.light { background: var(--pf-iris-soft); color: var(--pf-iris); }
.pi-tgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 78px; gap: 8px; }
.pi-ttile { position: relative; padding: 0; border-radius: 10px; border: 1px solid var(--pf-line); overflow: hidden; cursor: zoom-in; background: #05070d; transition: border-color .16s, box-shadow .16s; }
.pi-ttile.opg { grid-column: span 2; }
.pi-ttile .pi-img { width: 100%; height: 100%; }
.pi-ttile:hover, .pi-ttile:focus-visible { border-color: var(--pf-iris); box-shadow: 0 0 0 3px var(--pf-glow); outline: none; }
.pi-tdate { position: absolute; inset-inline-start: 6px; bottom: 5px; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: rgba(8, 10, 18, 0.72); color: #e9edf8; }
.pi-ttile.more { display: grid; place-items: center; cursor: pointer; background: var(--pf-surface); color: var(--pf-iris); font: inherit; font-size: 13px; font-weight: 700; }

/* the selected tooth, under the chart: picture of the tooth, what was done, pictures of those days */
.pt-tooth { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; align-items: start; padding: 20px 22px; border-radius: 16px; background: var(--pf-raised); }
.pt-tooth-zoom { display: grid; place-items: center; min-height: 200px; }
.pt-tooth-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pt-tooth-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.pt-tooth-head b { font-size: 34px; font-weight: 700; line-height: 1; }
.pt-tooth-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pt-tooth-hist li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--pf-line); }
.pt-tooth-hist li:first-child { border-top: 0; padding-top: 2px; }
.pt-tooth-hist .d { font-size: 12px; color: var(--pf-muted); white-space: nowrap; }
.pt-tooth-hist .s { font-size: 14px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; text-align: start; }
@media (max-width: 1100px) {
  .pt-tooth { grid-template-columns: 120px minmax(0, 1fr); }
  .pt-tooth .pi-tooth { grid-column: 1 / -1; }
  .pi-tgrid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
@media (max-width: 600px) {
  .pt-tooth { grid-template-columns: 84px minmax(0, 1fr); gap: 16px; padding: 16px; }
  .pt-tooth-zoom { min-height: 0; }
  .pt-tooth-hist li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .pi-tgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* full-screen viewer (always dark: pictures are read on a dark field) */
.pf.pi-viewer { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 0; padding: 0; background: #06080e; color: #e9edf8; animation: pfFade .2s ease both; --pf-iris: #8c9bff; --pf-glow: rgba(140, 155, 255, 0.2); }
.pi-vtop { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid rgba(160, 175, 230, 0.12); }
.pi-vinfo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; flex: 1; font-size: 14px; }
.pi-vdim { font-size: 12px; color: #8e99b8; }
.pi-vpos { font-size: 13px; color: #8e99b8; white-space: nowrap; }
.pi-kind { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(140, 155, 255, 0.16); color: #c3cbff; }
.pi-kind.opg { background: #c3cbff; color: #0b1020; }
.pi-kind.check { background: rgba(255, 132, 102, 0.18); color: #ffb39f; }
.pi-vbtn { height: 38px; min-width: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid rgba(160, 175, 230, 0.2); background: rgba(255, 255, 255, 0.04); color: #e9edf8; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; display: inline-grid; place-items: center; }
.pi-vbtn.wide { font-size: 13px; padding: 0 14px; }
.pi-vbtn:hover { background: rgba(255, 255, 255, 0.09); }
.pi-vbtn:disabled { opacity: .4; cursor: default; }
.pi-vbtn.on { background: #c3cbff; color: #0b1020; border-color: #c3cbff; }
.pi-vbtn:focus-visible, .pi-nav:focus-visible, .pi-fthumb:focus-visible { outline: 2px solid #a7b4ff; outline-offset: 2px; }
.pi-stage { position: relative; overflow: hidden; min-height: 0; cursor: zoom-in; touch-action: none; }
.pi-stage.zoomed { cursor: grab; }
.pi-stage.zoomed:active { cursor: grabbing; }
.pi-full { width: 100%; height: 100%; background: transparent; }
.pi-stage > .pi-full { position: absolute; inset: 12px 72px; width: auto; height: auto; display: block; }   /* always fits the screen; zoom only by the buttons */
.pi-full img { max-width: 100%; max-height: 100%; }
.pi-sharp { opacity: 0; }
.pi-sharp.on { opacity: 1; transition: opacity .2s ease; }
.pi-sharp::after, .pi-under::after { display: none; }
.pi-under img { filter: blur(1px); }
.pi-full img { transition: transform .12s ease-out, filter .12s; transform-origin: center; }
.pi-vload { position: absolute; font-size: 13px; color: #8e99b8; }
.pi-nav { position: absolute; top: 50%; translate: 0 -50%; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(160, 175, 230, 0.22); background: rgba(12, 16, 30, 0.72); color: #e9edf8; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(6px); }
.pi-nav.prev { inset-inline-start: 16px; }
.pi-nav.next { inset-inline-end: 16px; }
.pi-nav:hover { background: rgba(40, 50, 90, 0.85); }
[dir="ltr"] .pi-nav svg { transform: scaleX(-1); }
.pi-vtools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 22px; padding: 10px 16px; border-top: 1px solid rgba(160, 175, 230, 0.12); }
.pi-vgroup { display: flex; align-items: center; gap: 8px; }
.pi-zoom { min-width: 52px; text-align: center; font-size: 13px; color: #c9d1ea; }
.pi-slider { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #c9d1ea; }
.pi-slider input { width: 130px; accent-color: #a7b4ff; }
.pi-film { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 14px; scrollbar-width: thin; scrollbar-color: #2a3352 transparent; }
.pi-fthumb { flex: none; width: 78px; height: 58px; padding: 0; border-radius: 8px; border: 2px solid transparent; overflow: hidden; background: #05070d; cursor: pointer; opacity: .6; transition: opacity .15s, border-color .15s; }
.pi-fthumb.opg { width: 124px; }
.pi-fthumb .pi-img { width: 100%; height: 100%; }
.pi-fthumb[aria-current="true"] { border-color: #a7b4ff; opacity: 1; }
.pi-fthumb:hover { opacity: 1; }
@media (max-width: 760px) {
  .pi-stage > .pi-full { inset: 8px; }
  .pi-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .pi-slider input { width: 96px; }
  .pi-nav { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .pi-img img, .pf.pi-viewer { animation: none; }
  .pi-img.loading::after, .pi-img.idle::after { animation: none; }
  .pi-full img, .pi-tile { transition: none; }
}
