/* OrthoPlan Pro — the case shell's own components (6 Nov 2026, package S).
 *
 *   the Treatment journey line above every step       R-PHO-04
 *   the floating Photos button and its bar            C17-PHO-01 (fix/photos18)
 *   the photo dock and the large viewer               R-PHO-05/06, R-SYS-15
 *   the collected-photos layout                       R-PHO-03, C17-PHO-04
 *   the Follow-up timeline, a collage per visit       C17-PHO-03
 *
 * These are features, not the look, so they are NOT behind the design
 * layer's kill switch (`op-ds`): with "New look" off they still work, drawn
 * in today's tokens. The new look itself is css/op-zz-design.css.
 *
 * Layers (R-PHO-06): wizard footer 45 · Notes pill 55 · dock handle 56 ·
 * the floating Photos button and its bar 56 · scrim 57 · dock panel 58 ·
 * Notes panel 61 · the large viewer 990 · lightbox 1001 (a photo opened
 * from the viewer lands on top of it).
 */

/* ---------- Step groups: invisible without the design layer ----------
   The step bar's links are grouped by phase in the markup. Without the new
   look the groups are `display: contents`, so the links stay direct flex
   items of today's one-row scroller and nothing about it changes. */
.op-frontend .op-step-group { display: contents; }
.op-frontend .op-step-phase { display: none; }

/* ---------- The Treatment journey line (R-PHO-04) ---------- */
.op-frontend .op-jline {
    display: inline-flex; align-items: center; gap: 10px; min-width: 0;
    min-height: 36px; padding: 4px 12px 4px 6px;
    border: 1px solid var(--op-border); border-radius: var(--op-radius-pill);
    background: var(--op-surface); color: var(--op-text);
    text-decoration: none !important;
}
.op-frontend .op-jline:hover { border-color: var(--op-accent); }
.op-frontend .op-jline-track { display: flex; align-items: center; margin: 0; padding: 0; list-style: none; }
.op-frontend .op-jline-node { display: flex; align-items: center; }
.op-frontend .op-jline-node + .op-jline-node::before {
    content: ''; width: 8px; height: 2px; background: var(--op-border-strong);
}
.op-frontend .op-jline-node.is-completed + .op-jline-node::before { background: var(--op-primary); }
.op-frontend .op-jline-dot {
    width: 20px; height: 20px; flex: none; box-sizing: border-box;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1.5px solid var(--op-border-strong);
    background: var(--op-surface); color: var(--op-text-muted);
    font-size: 11px; font-weight: 800; line-height: 1;
}
.op-frontend .op-jline-node.is-completed .op-jline-dot { background: var(--op-primary); border-color: var(--op-primary); color: #fff; }
.op-frontend .op-jline-node.is-current .op-jline-dot {
    border-color: var(--op-accent); color: var(--op-text);
    box-shadow: 0 0 0 3px rgba(193, 156, 79, .28);
}
.op-frontend .op-jline-text { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; white-space: nowrap; font-size: 12px; }
.op-frontend .op-jline-pct { font-weight: 800; color: var(--op-primary); unicode-bidi: plaintext; }
.op-frontend .op-jline-stage {
    font-weight: 600; color: var(--op-text-muted);
    overflow: hidden; text-overflow: ellipsis; max-width: 22ch;
}
/* ux2 (question 15): at the top of the work area, above every step, in the
   page's flow — it scrolls away with the step; the case bar alone is sticky.
   Its own line, as wide as its markers and words, never wider than the step. */
.op-frontend .op-workarea > .op-jline {
    display: flex; width: max-content; max-width: 100%; box-sizing: border-box;
    margin: 0 0 var(--op-sp-3);
}
@media (max-width: 767px) {
    .op-frontend .op-workarea > .op-jline .op-jline-stage { max-width: 14ch; }
}

/* fix/photos18 (C17-PHO-02): the photo rail's head and strip are gone with the rail. */

/* ---------- The photo dock (R-PHO-05/06) ---------- */
/* Tablet, and any width inside a WordPress theme: an edge tab on the
   inline-end edge, opening a drawer. */
.op-frontend .op-dock-tab {
    position: fixed; z-index: 56;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid var(--op-border); background: var(--op-surface); color: var(--op-text);
    box-shadow: var(--op-shadow-lg); cursor: pointer; font: inherit; font-weight: 700;
    inset-inline-end: 0; top: 46%;
    flex-direction: column; width: 46px; min-height: 96px; padding: 10px 4px;
    border-inline-end: 0; border-start-end-radius: 0; border-end-end-radius: 0;
    border-start-start-radius: var(--op-radius-md); border-end-start-radius: var(--op-radius-md);
    font-size: 11px;
}
.op-frontend .op-dock-tab-count {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--op-primary); color: #fff; font-size: 11px; font-weight: 800;
}
.op-frontend .op-dock-tab[aria-expanded="true"] { background: var(--op-primary); color: #fff; border-color: var(--op-primary); }
.op-frontend .op-dock-strip { display: none; }
/* Patient Photos IS the photos: no dock handle there (R-PHO-05). */
.op-frontend[data-active-step="photos"] .op-dock-tab,
.op-frontend[data-active-step="photos"] .op-dock-strip,
.op-frontend[data-active-step="photos"] .op-photos-float,
.op-frontend[data-active-step="photos"] .op-photos-bar { display: none !important; }

.op-frontend .op-dock-tab-icon { font-size: 18px; }

/* The edge tab keeps its own strip of the page free on a tablet. */
@media (min-width: 641px) and (max-width: 1279px) {
    body.orthoplan-fullscreen .op-frontend.op-has-dock { padding-inline-end: 54px; }
}
/* Phone: a round button directly above the round Notes button. */
@media (max-width: 640px) {
    .op-frontend .op-dock-tab {
        top: auto; inset-inline-end: auto; inset-inline-start: var(--op-sp-3);
        inset-block-end: calc(var(--op-wizard-h, 68px) + var(--op-sp-4) + 54px);
        width: 46px; height: 46px; min-height: 0; padding: 0; flex-direction: row;
        border: 1px solid var(--op-border); border-radius: 50%;
    }
    .op-frontend .op-dock-tab-text { display: none; }
    .op-frontend .op-dock-tab-count { position: absolute; top: -4px; inset-inline-end: -4px; }
}

/* fix/photos18 (C17-PHO-01): below 1280, and inside a theme at any width, the
   floating Photos button is the handle — the edge tab and the round phone
   button it replaces are not drawn. */
@media (max-width: 1279px) {
    .op-frontend .op-dock-tab { display: none !important; }
}
.op-frontend:not(.op-app) .op-dock-tab { display: none !important; }

/* ≥ 1280, in the app: a filmstrip lane at the inline-end edge, always on
   screen; the step keeps the lane's width free, so nothing is under it. */
@media (min-width: 1280px) {
    /* (0,4,1), to meet the page column's own padding rule in public.css. */
    body.orthoplan-fullscreen .op-frontend.op-app.op-has-dock { padding-inline-end: calc(var(--op-lane-w, 64px) + 28px); }
    .op-frontend.op-app .op-dock-tab {
        top: var(--op-chrome-top, 140px); inset-inline-end: 12px; inset-block-end: auto;
        width: var(--op-lane-w, 64px); height: 64px; min-height: 0; padding: 6px 4px; box-sizing: border-box;
        border: 1px solid var(--op-border); border-radius: var(--op-radius-md);
    }
    .op-frontend.op-app .op-dock-tab-count { position: absolute; top: 4px; inset-inline-end: 4px; }
    .op-frontend.op-app .op-dock-strip {
        position: fixed; z-index: 56; display: flex; flex-direction: column; gap: 6px;
        top: calc(var(--op-chrome-top, 140px) + 72px); bottom: 12px; inset-inline-end: 12px;
        width: var(--op-lane-w, 64px); overflow: visible;
    }
    /* fix/photos18: the strip ends above the floating Photos button, which
       sits in the lane two thirds down; cut there top and bottom only, so a
       thumbnail's hover preview still opens beside it. */
    .op-frontend.op-app .op-dock:has(.op-photos-float) .op-dock-strip {
        bottom: calc(100vh - var(--op-float-top) + 12px);
        clip-path: inset(0 -480px 0 -480px);
    }
}
.op-frontend .op-dock-thumb {
    position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; flex: none;
    border-radius: 6px; overflow: visible; background: var(--op-bg-alt); cursor: zoom-in;
}
.op-frontend .op-dock-thumb > img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 6px; }
/* The hover preview: the same thumbnail, larger — no new request. */
.op-frontend .op-dock-peek {
    position: absolute; top: 0; inset-inline-end: calc(100% + 12px);
    width: 300px; padding: 6px; display: none;
    background: var(--op-surface); border: 1px solid var(--op-border);
    border-radius: var(--op-radius-md); box-shadow: var(--op-shadow-lg);
    pointer-events: none; z-index: 2;
}
.op-frontend .op-dock-peek img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; display: block; background: var(--op-bg-alt); border-radius: 4px; }
.op-frontend .op-dock-peek span { display: block; padding-top: 4px; font-size: 12px; font-weight: 700; }
@media (hover: hover) and (pointer: fine) {
    .op-frontend .op-dock-thumb:hover .op-dock-peek { display: block; }
}

/* ---------- fix/photos18 (C17-PHO-01): the floating Photos button ----------
   «يا اما تبقى فلوتنج … وتبقى وكانها بتنور كده او بطنبض». At the inline-end
   edge two thirds down (the left edge in Arabic), on every step but Patient
   Photos, at every width; fixed, so it stays while the page scrolls. It is
   far above the bottom bar on every screen (two thirds of 390 px is 260,
   the bar starts at 330). A slim tab against the edge below 1280 (a 44 px
   target, 40 px of it on the screen), a round button in the lane from 1280.
   It glows gently — a soft ring, every 3 s — never while the bar or the dock
   is open, never with "reduce motion"; and it steps aside while a field has
   the focus (op-photos-typing, op-shell.js). Below 1280 the step keeps a lane
   free for it (below), so it is over no field at any width. */
.op-frontend { --op-float-top: calc(66.6vh - 28px); }
.op-frontend .op-photos-float {
    position: fixed; z-index: 56;
    top: var(--op-float-top); inset-inline-end: 0;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    width: 44px; height: 56px; padding: 0; box-sizing: border-box;
    border: 1px solid var(--op-primary); border-inline-end: 0;
    border-start-start-radius: 28px; border-end-start-radius: 28px;
    border-start-end-radius: 0; border-end-end-radius: 0;
    background: var(--op-primary); color: #fff;
    box-shadow: var(--op-shadow-lg); cursor: pointer; font: inherit;
    animation: op-photos-glow 3.2s ease-out infinite;
    transition: opacity .15s ease, transform .15s ease;
}
.op-frontend .op-photos-float .op-photos-float-icon { display: inline-flex; font-size: 20px; line-height: 1; }
.op-frontend .op-photos-float .op-photos-float-icon .op-ic { width: 22px; height: 22px; background-color: currentColor; }
.op-frontend .op-photos-float-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.op-frontend .op-photos-float:hover { filter: brightness(1.08); }
.op-frontend .op-photos-float:focus-visible { outline: 3px solid var(--op-primary-light); outline-offset: 2px; }
@keyframes op-photos-glow {
    0%   { box-shadow: var(--op-shadow-lg), 0 0 0 0 color-mix(in srgb, var(--op-primary) 45%, transparent); }
    55%  { box-shadow: var(--op-shadow-lg), 0 0 0 12px color-mix(in srgb, var(--op-primary) 0%, transparent); }
    100% { box-shadow: var(--op-shadow-lg), 0 0 0 0 color-mix(in srgb, var(--op-primary) 0%, transparent); }
}
/* Still while it is open (the bar, or the dock it opened), and for "reduce motion" never moving at all. */
.op-frontend .op-photos-float[aria-expanded="true"],
.op-frontend .op-dock:not([data-dock-state="shut"]) .op-photos-float { animation: none; }
@media (prefers-reduced-motion: reduce) {
    .op-frontend .op-photos-float { animation: none; transition: none; }
    .op-frontend .op-photos-bar { animation: none; }
}
/* A field has the focus: out of the way of what he is typing. */
.op-frontend.op-photos-typing .op-photos-float { opacity: 0; pointer-events: none; transform: translateX(8px); }
[dir="rtl"] .op-frontend.op-photos-typing .op-photos-float, .op-frontend[dir="rtl"].op-photos-typing .op-photos-float { transform: translateX(-8px); }
/* The large viewer and the editors cover the page: the button with them. */
.op-frontend .op-dock[data-dock-state="large"] .op-photos-float,
html.op-ann-open .op-frontend .op-photos-float { visibility: hidden; }

/* Its bar: Initial and Timeline, slid out beside it. */
.op-frontend .op-photos-bar {
    position: fixed; z-index: 56;
    top: calc(var(--op-float-top) + 28px); transform: translateY(-50%);
    inset-inline-end: 52px;
    display: flex; gap: 4px; padding: 4px;
    border: 1px solid var(--op-border); border-radius: var(--op-radius-lg);
    background: var(--op-surface); box-shadow: var(--op-shadow-lg);
    animation: op-photos-bar-in .16s ease-out;
}
.op-frontend .op-photos-bar[hidden] { display: none; }
@keyframes op-photos-bar-in { from { opacity: 0; } to { opacity: 1; } }
.op-frontend .op-photos-bar-btn {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 48px; min-width: 44px; padding: 0 14px;
    border: 0; border-radius: var(--op-radius); background: none; color: var(--op-text);
    font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.op-frontend .op-photos-bar-btn:hover, .op-frontend .op-photos-bar-btn:focus-visible { background: var(--op-primary-light); color: var(--op-primary); outline: none; }
.op-frontend .op-photos-bar-btn .op-ic { width: 20px; height: 20px; }

@media (min-width: 1280px) {
    /* In the lane, two thirds down: round, the lane's width. */
    .op-frontend.op-app .op-photos-float {
        inset-inline-end: calc(12px + (var(--op-lane-w, 64px) - 56px) / 2);
        width: 56px; border-radius: 50%; border-inline-end: 1px solid var(--op-primary);
    }
    .op-frontend.op-app .op-photos-bar { inset-inline-end: calc(12px + var(--op-lane-w, 64px) + 8px); }
    /* Kept open as a column, the photos are already beside the step. */
    .op-frontend.op-app.op-dock-pinned .op-photos-float,
    .op-frontend.op-app.op-dock-pinned .op-photos-bar { display: none; }
}
/* It covers no field on a tablet: from 641 to 1023 the new look's 16 px edge
   and a card's 24 px came to 40 (a step's Save, outside its card, to 32),
   under the 44 px button — the case's steps keep 12 px more at the inline-end
   edge there (from 1024 the edge is 24 px; from 1280 the button is in the
   lane). */
@media (min-width: 641px) and (max-width: 1023px) {
    body.orthoplan-fullscreen .op-frontend.op-app.op-has-dock.op-case-detail:not([data-active-step="photos"]) { padding-inline-end: calc(var(--ds-gutter, 16px) + 12px); }
}
/* Merge of 18 Nov (photos18 + steps18): from 1024 to 1279 the edge is 24 px and the
   button 44, so a control set at the end of a card's row (Clinical Steps' Print beside
   its sets) ran 20 px under it. The work area keeps 24 px more there (not the bar below
   it): what is in it stops 48 px from the screen's edge, 4 px clear of the button. */
@media (min-width: 1024px) and (max-width: 1279px) {
    body.orthoplan-fullscreen .op-frontend.op-app.op-has-dock.op-case-detail:not([data-active-step="photos"]) .op-workarea { padding-inline-end: 24px; }
}
/* And on a phone: there the cards run edge to edge and a field ran to 16 px
   from the screen's edge (a check row to 8), under the 44 px button. The
   step keeps a lane of 32 px more at the inline-end edge — the cards' own
   white still runs to the screen's edge behind the button, what is in them
   stops 48 px short of it (4 px clear of the button). The bar, the case
   strip and the step names above are not under it and are left as they are. */
@media (max-width: 640px) {
    .op-frontend.op-has-dock.op-case-detail:not([data-active-step="photos"]) { --op-float-lane: 32px; }
    .op-frontend.op-has-dock.op-case-detail:not([data-active-step="photos"]) .op-workarea { padding-inline-end: var(--op-float-lane); }
    .op-ds.op-has-dock.op-case-detail:not([data-active-step="photos"]) .op-tab-panel .op-card { padding-inline-end: calc(var(--ds-sp-4) + var(--op-float-lane)); }
    .op-ds.op-has-dock.op-case-detail:not([data-active-step="photos"]) .op-tab-panel .op-card:not(.op-stc-phase2-body .op-card),
    .op-ds.op-has-dock.op-case-detail:not([data-active-step="photos"]) .op-tab-panel .op-stc-phase2 { margin-inline-end: calc(-1 * (var(--ds-gutter) + var(--op-float-lane))); }
    .op-ds.op-has-dock.op-case-detail:not([data-active-step="photos"]) .op-tab-panel .op-stc-phase2 > .op-stc-phase2-head { padding-inline-end: calc(var(--ds-gutter) + var(--op-float-lane)); }
    /* "Whole arch" (a phone's overview: the 16 teeth in the width, a TAD or
       hook site 18 px round) takes the lane back — its teeth as wide as they
       were, no two sites sharing a tap — and the button steps aside while a
       chart of the step is whole, as it does while a field has the focus. */
    .op-ds.op-has-dock.op-case-detail:not([data-active-step="photos"]) .op-tab-panel .op-tc-whole { margin-inline-end: calc(-1 * var(--op-float-lane)); }
    .op-frontend.op-case-detail:has(.op-tab-panel.active .op-tc-whole) .op-photos-float { opacity: 0; pointer-events: none; transform: translateX(8px); }
    [dir="rtl"] .op-frontend.op-case-detail:has(.op-tab-panel.active .op-tc-whole) .op-photos-float,
    .op-frontend.op-case-detail[dir="rtl"]:has(.op-tab-panel.active .op-tc-whole) .op-photos-float { transform: translateX(-8px); }
}
/* Below 1280 a check row's hover wash reached 8 px past its card's padding
   (3 px under the button at 1024): there it stops at the card's content. */
@media (max-width: 1279px) {
    .op-ds.op-has-dock.op-case-detail:not([data-active-step="photos"]) .op-tab-panel .op-check-tile { margin-inline-end: 0; }
}
/* Inside a WordPress theme the button is at the screen's edge at every width
   (no lane): from a tablet up the step keeps 32 px more there too (merge of 18 Nov:
   at 12 Clinical Steps' Print, at the end of its sets' row, ran 16 px under it at
   768), and a check row stops at its card's content. */
@media (min-width: 641px) {
    .op-frontend.op-has-dock.op-case-detail:not(.op-app):not([data-active-step="photos"]) .op-workarea { padding-inline-end: 32px; }
    .op-ds.op-has-dock.op-case-detail:not(.op-app):not([data-active-step="photos"]) .op-tab-panel .op-check-tile { margin-inline-end: 0; }
}
/* With "New look" off the 3.0 edge from 1024 to 1279 is narrower: 12 px more there. */
@media (min-width: 1024px) and (max-width: 1279px) {
    .op-frontend.op-app.op-has-dock.op-case-detail:not(.op-ds):not([data-active-step="photos"]) .op-workarea { padding-inline-end: 12px; }
}

/* The panel. Hidden until opened; then by width and state. */
/* A drawer by default: tablets, and inside a theme. */
.op-frontend .op-dock-panel {
    position: fixed; z-index: 58; display: flex; flex-direction: column;
    background: var(--op-surface); border: 1px solid var(--op-border);
    box-shadow: var(--op-shadow-lg); overflow: hidden;
    top: 0; bottom: 0; inset-inline-end: 0; width: min(420px, 85vw);
    border-start-start-radius: var(--op-radius-lg); border-end-start-radius: var(--op-radius-lg);
}
.op-frontend .op-dock-panel[hidden] { display: none !important; }
.op-frontend .op-dock-scrim {
    position: fixed; inset: 0; z-index: 57; background: rgba(14, 28, 36, .38);
}
.op-frontend .op-dock-scrim[hidden] { display: none !important; }
/* Phone: a bottom sheet. */
@media (max-width: 640px) {
    .op-frontend .op-dock-panel {
        top: auto; inset-inline: 0; bottom: 0; width: auto; height: 78vh;
        border-radius: var(--op-radius-lg) var(--op-radius-lg) 0 0;
        overscroll-behavior: contain;
    }
}
/* ≥ 1280 in the app: non-modal, beside the filmstrip; the step stays usable. */
@media (min-width: 1280px) {
    .op-frontend.op-app .op-dock-panel {
        /* Above the wizard bar: Next is never under the photos. */
        top: var(--op-chrome-top, 140px); bottom: calc(var(--op-wizard-h, 68px) + 10px);
        inset-inline-end: calc(var(--op-lane-w, 64px) + 24px);
        width: min(440px, 40vw); border-radius: var(--op-radius-lg);
    }
    .op-frontend.op-app .op-dock:not([data-dock-state="large"]) .op-dock-scrim { display: none !important; }
}
/* ≥ 1440: kept open as a column; the step narrows by its width. */
.op-frontend.op-dock-pinned { --op-dock-w: clamp(360px, 28vw, 440px); }
@media (min-width: 1440px) {
    body.orthoplan-fullscreen .op-frontend.op-app.op-dock-pinned { padding-inline-end: calc(var(--op-dock-w) + 16px); }
    .op-frontend.op-app.op-dock-pinned .op-dock-tab,
    .op-frontend.op-app.op-dock-pinned .op-dock-strip { display: none; }
    .op-frontend.op-app.op-dock-pinned .op-dock:not([data-dock-state="large"]) .op-dock-panel {
        top: var(--op-chrome-top, 140px); bottom: 0; inset-inline-end: 0; width: var(--op-dock-w);
        border-radius: 0; border-block-end: 0; border-inline-end: 0; box-shadow: none;
    }
    .op-frontend.op-app.op-dock-pinned .op-msg-panel { inset-inline-end: calc(var(--op-dock-w) + 16px); }
}
/* Large: the Collected photos / Follow-up timeline viewer over the page. */
.op-frontend .op-dock[data-dock-state="large"] .op-dock-scrim { z-index: 989; }
.op-frontend .op-dock[data-dock-state="large"] .op-dock-panel {
    z-index: 990; top: max(16px, 3vh); bottom: max(16px, 3vh);
    inset-inline: max(12px, calc((100vw - 1180px) / 2)); width: auto; height: auto;
    border-radius: var(--op-radius-lg);
}

.op-frontend .op-dock-head {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
    padding: 10px 14px; border-bottom: 1px solid var(--op-border); background: var(--op-bg);
}
.op-frontend .op-dock-grip { display: none; }
@media (max-width: 640px) {
    .op-frontend .op-dock-grip { display: block; width: 44px; height: 4px; margin: -2px calc(50% - 22px) 2px; border-radius: 4px; background: var(--op-border-strong); }
}
.op-frontend .op-dock-title { margin: 0; font-size: 14px; font-weight: 800; display: flex; align-items: baseline; gap: 8px; }
.op-frontend .op-dock-sub { font-size: 12px; font-weight: 600; color: var(--op-text-muted); }
.op-frontend .op-dock-tabs { display: flex; gap: 4px; flex-wrap: wrap; order: 3; flex-basis: 100%; }
.op-frontend .op-dock-tabbtn {
    min-height: 34px; padding: 4px 12px; cursor: pointer; border-radius: var(--op-radius-pill);
    border: 1px solid var(--op-border-strong); background: var(--op-surface); color: var(--op-text);
    font: inherit; font-size: 12.5px; font-weight: 700;
}
.op-frontend .op-dock-tabbtn.is-active { background: var(--op-primary); border-color: var(--op-primary); color: #fff; }
.op-frontend .op-dock-ctl { display: flex; gap: 4px; margin-inline-start: auto; }
.op-frontend .op-dock-btn {
    width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--op-border); border-radius: var(--op-radius); cursor: pointer;
    background: var(--op-surface); color: var(--op-text); font: inherit; font-size: 16px;
}
.op-frontend .op-dock-btn[aria-pressed="true"] { background: var(--op-primary); border-color: var(--op-primary); color: #fff; }
/* "Keep open" exists only where the step can make room for it. */
.op-frontend .op-dock-pin { display: none; }
@media (min-width: 1440px) { .op-frontend.op-app .op-dock-pin { display: inline-flex; } }
.op-frontend .op-dock[data-dock-state="large"] .op-dock-pin,
.op-frontend .op-dock[data-dock-state="large"] .op-dock-large { display: none; }
.op-frontend .op-dock-body { flex: 1; overflow: auto; padding: 12px 14px 16px; overscroll-behavior: contain; }
.op-frontend .op-dock-pane[hidden] { display: none; }
.op-frontend .op-dock-pane > .op-card { margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }

/* ---------- Collected photos (R-PHO-02/03) ---------- */
.op-frontend .op-cp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; container-type: inline-size; }
/* fix/photos18 (C17-PHO-04): two groups, each with its caption, a rule between
   them; narrow (the dock beside the step, a phone), one group a line. */
.op-frontend .op-cp-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.op-frontend .op-cp-group-cap { font-size: 12px; font-weight: 700; color: var(--op-text-muted); white-space: nowrap; }
.op-frontend .op-cp-group + .op-cp-group { padding-inline-start: 12px; border-inline-start: 1px solid var(--op-border-strong); }
@container (max-width: 560px) {
    .op-frontend .op-cp-group { flex: 1 0 100%; }
    .op-frontend .op-cp-group + .op-cp-group { padding-inline-start: 0; border-inline-start: 0; }
    .op-frontend .op-cp-group-cap { min-width: 5em; }
    .op-frontend .op-cp-actions { margin-inline-start: 0; }
}
.op-frontend .op-cp-actions { display: flex; gap: 6px; margin-inline-start: auto; }
.op-frontend .op-seg {
    display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--op-bg-alt);
}
.op-frontend .op-seg-btn {
    min-height: 32px; padding: 4px 12px; border: 0; border-radius: 7px; cursor: pointer;
    background: transparent; color: var(--op-text-muted); font: inherit; font-size: 12.5px; font-weight: 700;
}
.op-frontend .op-seg-btn.is-active { background: var(--op-primary); color: #fff; box-shadow: var(--op-shadow-sm); }
/* A picture of the patient: Buccal right stays on the viewer's left in
   Arabic too, like the tooth chart. The captions keep the page's direction. */
.op-frontend .op-cp-grid { display: grid; gap: 8px; direction: ltr; }
.op-frontend .op-cp-grid[hidden] { display: none; }
.op-frontend .op-cphotos[data-mode="all"] [data-kind="xray"] { display: none; }
.op-frontend .op-cp-cell {
    display: flex; flex-direction: column; gap: 4px; min-width: 0;
    color: inherit; text-decoration: none !important;
}
.op-frontend .op-cp-shot {
    position: relative; display: flex; align-items: center; justify-content: center;
    overflow: hidden; border-radius: var(--op-radius);
    background: #1d2a32;
}
.op-frontend .op-cp-shot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.op-frontend .op-cp-cell.is-missing .op-cp-shot,
.op-frontend .op-cp-cell.is-file .op-cp-shot { background: var(--op-bg); border: 1.5px dashed var(--op-border-strong); }
.op-frontend .op-cp-missing, .op-frontend .op-cp-file { font-size: 12px; color: var(--op-text-muted); text-align: center; padding: 4px; overflow-wrap: anywhere; }
.op-frontend .op-cp-cap {
    direction: inherit; font-size: 12px; font-weight: 600; color: var(--op-text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
[dir="rtl"] .op-frontend .op-cp-cap { direction: rtl; }
.op-frontend .op-cp-files { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.op-frontend .op-cp-files a { display: inline-flex; min-height: 32px; align-items: center; }

/* ---------- fix/collage: the records montage's shapes (R-PHO-03) ----------
   OrthoPlan_Attachments::collage_layout() gives every cell its span (twelfths
   of the row) and its aspect, as --op-cp-span / --op-cp-aspect on the cell:
   upright faces, landscape teeth. A cell is that many twelfths of the row
   wide, gaps included, so a face (3) and a buccal (4) line up under one
   another; a shorter row (the two occlusals) is centred. The whole photo is
   shown in its cell, never cropped (object-fit: contain, above). The rows
   keep the grid's left-to-right, so the patient's right is on the viewer's
   left in Arabic too. "Download image" draws the same arithmetic. */
.op-frontend .op-cp-row { display: flex; justify-content: center; align-items: flex-start; gap: 8px; }
.op-frontend .op-cp-row > .op-cp-cell {
    flex: 0 0 calc((100% + 8px) * var(--op-cp-span, 4) / 12 - 8px);
    max-width: calc((100% + 8px) * var(--op-cp-span, 4) / 12 - 8px);
}
.op-frontend .op-cp-row > .op-cp-cell > .op-cp-shot { aspect-ratio: var(--op-cp-aspect, 4 / 3); }
/* Four faces to a row leave a narrow cell in the dock: the name may take two lines. */
.op-frontend .op-cp-row > .op-cp-cell > .op-cp-cap { white-space: normal; text-overflow: clip; line-height: 1.25; text-align: center; }
/* The large viewer shows the photo montage whole, as one picture: it is as
   wide as the screen's height lets the three rows fit (a click on a photo
   still opens it full size). */
.op-frontend .op-dock[data-dock-state="large"] .op-cp-grid { max-width: max(560px, min(1040px, calc((100vh - 320px) * 1.2))); margin-inline: auto; }
@supports not (aspect-ratio: 1 / 1) {
    .op-frontend .op-cp-row > .op-cp-cell > .op-cp-shot { height: 0; padding-top: calc(100% / var(--op-cp-aspect, 1.3333)); }
    .op-frontend .op-cp-row > .op-cp-cell > .op-cp-shot img { position: absolute; inset: 0; }
}

/* ---------- The Follow-up timeline in the dock (R-FUP-24) ---------- */
/* fix/photos18 (C17-PHO-03): a date is one collage, as wide as the session. */
.op-frontend .op-session-grid > .op-tl-collage,
.op-frontend .op-session-grid > .op-tl-rest { grid-column: 1 / -1; min-width: 0; }
.op-frontend .op-tl-collage-bar { justify-content: flex-end; margin-bottom: 8px; }
.op-frontend .op-tl-rest { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.op-frontend .op-session-line,
.op-frontend .op-session-empty { grid-column: 1 / -1; }
.op-frontend .op-session-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin: 0 0 10px; font-size: 13px; }
.op-frontend .op-session-rec { color: var(--op-text-muted); }
/* fix/photos18 (review): the visit's record, under its collage. */
.op-frontend .op-session-recline { margin: 12px 0 0; }
/* fix/photos18 (review): in the dock the dates are compact — two to a row on a
   phone's sheet, the thumbnail smaller — so the date's collage is near them. */
.op-frontend .op-dock .op-session-card { flex: 1 1 150px; gap: 10px; padding-block: 6px; padding-inline: 6px 10px; }
.op-frontend .op-dock .op-session-collage { width: 44px; height: 44px; }
.op-frontend .op-session-nophoto { font-size: 18px; font-weight: 700; }
.op-frontend .op-dock .op-timeline > .op-fsec-head { margin-bottom: 12px; }
.op-frontend .op-session-collage.is-empty { display: flex; align-items: center; justify-content: center; color: var(--op-text-soft); }
.op-frontend .op-dock:not([data-dock-state="large"]) .op-gallery-pair { grid-template-columns: 1fr 1fr; }
.op-frontend .op-dock .op-gallery-pair { max-width: 760px; }

/* ---------- Print: only the collage (R-PHO-02 "Print") ---------- */
@media print {
    html.op-printing-collage body * { visibility: hidden !important; }
    html.op-printing-collage .op-dock-panel,
    html.op-printing-collage .op-dock-panel [data-dock-pane="collected"] .op-cp-grid:not([hidden]),
    html.op-printing-collage .op-dock-panel [data-dock-pane="collected"] .op-cp-grid:not([hidden]) * { visibility: visible !important; }
    html.op-printing-collage .op-dock-panel { position: absolute !important; inset: 0 !important; border: 0; box-shadow: none; }
    html.op-printing-collage .op-dock-head, html.op-printing-collage .op-cp-bar { display: none !important; }
    /* fix/collage: a row of the montage is never cut between two sheets. */
    html.op-printing-collage .op-cp-row { break-inside: avoid; page-break-inside: avoid; }
}
