/* ==========================================================================
   OrthoPlan Pro — draw and write on the real photos (16 Nov 2026,
   fix/annotate, R16-08). The "Photos — draw and write" card on Diagnosis
   and Clinical Steps (public/views/case/photo-annotate.php) and its editor
   (op-annotate.js).

   Calm: the card is one box with the montage in it, nothing boxed inside it
   but the controls; teal only for the chosen tool, colour and thickness and
   for Save; the five inks are the registry's --op-ink-* and appear only as
   a mark on the photo and as its swatch. Every button of the editor is
   44 px or more, on every screen. The drawing surface takes no touch
   gesture of the browser's (`touch-action: none`), so a finger draws and the
   page stays where it is. Right to left the toolbar reads from the right;
   the photo and the montage are never mirrored.
   ========================================================================== */

/* ---- The card ---- */
.op-frontend .op-ann-card .op-ann-figure {
    position: relative;
    max-width: 680px;
    margin: var(--op-sp-3) auto 0;
    direction: ltr;             /* the patient's right on the viewer's left, as on Collected photos */
    container-type: inline-size;   /* cqw: the names sit in the montage's own name band, whatever its width */
}
.op-frontend .op-ann-montage-svg,
.op-frontend .op-ann-svg {
    display: block;
    width: 100%;
    height: auto;
}
.op-frontend .op-ann-cellbg { fill: var(--op-bg-alt); }
.op-frontend .op-ann-cellmiss { fill: none; stroke: var(--op-border-strong); stroke-width: 3; stroke-dasharray: 10 8; }
/* The names' size is on the <text> itself (34 of the montage's 1984), as the JPG and the report write them. */
.op-frontend .op-ann-celltext { fill: var(--op-text-muted); }
.op-frontend .op-ann-layer { overflow: hidden; }

/*
 * On the card the names are the page's own type (see photo-annotate.php),
 * under each photo, in the montage's own name band (its 44 + 16 of 1984
 * under every row, as Collected photos' "Download image" writes them): the
 * name's foot sits at the foot of the band, so on a computer it is wholly
 * under the photo and on a phone, where the band is 10 px, it covers a
 * sliver of the photo's lower edge — never a third of it. One line; a name
 * too long for its cell ends in "…" (the whole name is the photo's button's
 * name and the editor's title).
 */
.op-frontend .op-ann-figure .op-ann-celltext { display: none; }
.op-frontend .op-ann-cap {
    position: absolute;
    display: flex; align-items: center; justify-content: center;
    padding: 4px;
    pointer-events: none;
}
.op-frontend .op-ann-cap-name {
    max-width: 100%;
    padding: 0 6px;
    border-radius: var(--op-radius-sm);
    color: var(--op-text);
    font-size: 12px; line-height: 18px; font-weight: 500;
    text-align: center;
    unicode-bidi: plaintext;    /* an Arabic name with an English (…) reads in its own order */
}
.op-frontend .op-ann-cap:not(.is-missing) .op-ann-cap-name {
    position: absolute; left: 0; right: 0;
    width: -webkit-fit-content; width: fit-content; margin: 0 auto;   /* centred under the photo, as wide as its name */
    bottom: -9px;                                /* without cqw: about the band on a phone */
    bottom: calc(1px - 60cqw / 19.84);           /* the foot of the band: 60 of the montage's 1984 */
    background: var(--op-surface);
    /* Two lines at most where the band is 20 px (the second covers the photo's lowest edge only). */
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    overflow: hidden;
}
/* A view not taken: its name in its dashed frame, wrapped, nothing under it to hide. */
.op-frontend .op-ann-cap.is-missing .op-ann-cap-name { color: var(--op-text-muted); font-weight: 400; overflow-wrap: anywhere; }
/* The "(…)" of a name is a run of its own: "(Upper occlusal)" after an Arabic name keeps its brackets in order, even wrapped. */
.op-frontend .op-ann-cap-more { unicode-bidi: isolate; }
/* A phone: one line, "…" when it is longer than its photo (the short name, plain text). */
.op-frontend .op-ann-cap .op-ann-cap-name.is-short { display: none; }
@media (max-width: 599px) {
    .op-frontend .op-ann-cap:not(.is-missing) .op-ann-cap-name.is-full { display: none; }
    .op-frontend .op-ann-cap:not(.is-missing) .op-ann-cap-name.is-short { display: block; padding: 0 4px; white-space: nowrap; text-overflow: ellipsis; }
}

/* A photo's cell, to tap: its place on the montage, nothing drawn over it until it is pointed at. */
.op-frontend .op-ann-hit {
    position: absolute;
    min-width: 0; min-height: 0;
    margin: 0; padding: 0;
    border: 2px solid transparent;
    border-radius: var(--op-radius-sm);
    background: transparent;
    cursor: pointer;
}
.op-frontend .op-ann-hit:hover { border-color: var(--op-border-strong); }
.op-frontend .op-ann-hit:focus-visible { outline: none; border-color: var(--op-primary); }

.op-frontend .op-ann-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
    gap: var(--op-sp-2) var(--op-sp-3);
    margin-top: var(--op-sp-3);
}
.op-frontend .op-ann-whole { min-height: 44px; display: inline-flex; align-items: center; gap: var(--op-sp-2); }
.op-frontend .op-ann-ic { display: inline-flex; width: 18px; height: 18px; }
.op-frontend .op-ann-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linejoin: round; }
.op-frontend .op-ann-count { font-size: 13px; color: var(--op-text-muted); }
.op-frontend .op-ann-stale { text-align: center; margin: var(--op-sp-2) 0 0; }

.op-frontend .op-ann-films {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--op-sp-3);
    max-width: 680px;
    margin: var(--op-sp-4) auto 0;
    direction: ltr;
}
.op-frontend .op-ann-film {
    display: flex; flex-direction: column; align-items: stretch; gap: var(--op-sp-1);
    min-height: 44px; padding: var(--op-sp-1);
    border: 1px solid var(--op-border); border-radius: var(--op-radius-sm);
    background: var(--op-surface); color: var(--op-text);
    cursor: pointer; text-align: center; font: inherit;
}
.op-frontend .op-ann-film:hover { border-color: var(--op-border-strong); }
.op-frontend .op-ann-film:focus-visible { outline: 2px solid var(--op-primary); outline-offset: 2px; }
.op-frontend .op-ann-film-shot { display: block; aspect-ratio: 4 / 3; background: var(--op-bg-alt); border-radius: var(--op-radius-sm); overflow: hidden; }
.op-frontend .op-ann-film-shot .op-ann-svg { width: 100%; height: 100%; }
.op-frontend .op-ann-film-name { font-size: 13px; color: var(--op-text-muted); }
[dir="rtl"] .op-frontend .op-ann-film-name, .op-frontend[dir="rtl"] .op-ann-film-name { direction: rtl; }

.op-frontend .op-ann-empty {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--op-sp-3);
    margin-top: var(--op-sp-3);
}
.op-frontend .op-ann-empty p { margin: 0; color: var(--op-text-muted); }
.op-frontend .op-ann-empty .op-btn { min-height: 44px; display: inline-flex; align-items: center; gap: var(--op-sp-1); }

/* ---- The editor ---- */
html.op-ann-open, html.op-ann-open body { overflow: hidden; }
.op-frontend .op-ann-modal[hidden] { display: none; }
.op-frontend .op-ann-modal {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: center; justify-content: center;
}
/* The scrim is the shared .op-modal-backdrop's (public.css, and the calm look's), as behind every dialog. */
.op-frontend .op-ann-backdrop { position: absolute; inset: 0; z-index: 0; }
.op-frontend .op-ann-box {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; gap: var(--op-sp-2);
    width: min(1240px, calc(100vw - 32px));
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    padding: var(--op-sp-3) var(--op-sp-4) var(--op-sp-4);
    border-radius: var(--op-radius-lg);
    background: var(--op-surface);
    box-shadow: var(--op-shadow-lg);
    color: var(--op-text);
}
.op-frontend .op-ann-head { display: flex; align-items: center; gap: var(--op-sp-3); }
.op-frontend .op-ann-title { flex: 1 1 auto; margin: 0; font-size: 18px; line-height: 26px; font-weight: 600; }
.op-frontend .op-ann-note {
    margin: 0; padding: var(--op-sp-2) var(--op-sp-3);
    border-radius: var(--op-radius-sm);
    background: var(--op-warning-bg); color: var(--op-warning-text);
    font-size: 13px; line-height: 18px;
}
.op-frontend .op-ann-note.is-info { background: var(--op-info-bg); color: var(--op-info-text); }
.op-frontend .op-ann-stagewrap {
    flex: 1 1 0; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.op-frontend .op-ann-stage {
    position: relative;
    direction: ltr;             /* the photo is never mirrored */
    background: var(--op-bg-alt);
    border-radius: var(--op-radius-sm);
    overflow: hidden;
}
.op-frontend .op-ann-draw {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    display: block;
    touch-action: none;         /* a finger draws: no scroll, no zoom, no swipe while it is on the photo */
    -webkit-user-select: none; user-select: none;
    -webkit-touch-callout: none;
}
.op-frontend .op-ann-stage[data-tool="pen"] .op-ann-draw,
.op-frontend .op-ann-stage[data-tool="line"] .op-ann-draw,
.op-frontend .op-ann-stage[data-tool="arrow"] .op-ann-draw,
.op-frontend .op-ann-stage[data-tool="ellipse"] .op-ann-draw { cursor: crosshair; }
.op-frontend .op-ann-stage[data-tool="text"] .op-ann-draw { cursor: text; }
.op-frontend .op-ann-stage[data-tool="erase"] .op-ann-draw { cursor: pointer; }
.op-frontend .op-ann-bg, .op-frontend .op-ann-marks, .op-frontend .op-ann-preview { pointer-events: none; }
.op-frontend .op-ann-status {
    position: absolute; inset: auto 0 0 0; margin: 0;
    padding: var(--op-sp-2); text-align: center;
    background: var(--op-surface); color: var(--op-text-muted); font-size: 13px;
}
.op-frontend .op-ann-textbox {
    position: absolute; z-index: 2;
    display: flex; align-items: center; gap: var(--op-sp-1);
    width: min(320px, 100%);
    padding: var(--op-sp-1);
    border: 1px solid var(--op-border-strong); border-radius: var(--op-radius-sm);
    background: var(--op-surface); box-shadow: var(--op-shadow-lg);
}
.op-frontend .op-ann-textbox[hidden] { display: none; }
.op-frontend .op-ann-textin {
    flex: 1 1 auto; min-width: 0; min-height: 44px;
    padding: 0 var(--op-sp-2);
    border: 1px solid var(--op-border); border-radius: var(--op-radius-sm);
    font: inherit; font-size: 16px;   /* 16 px: a phone does not zoom into the field */
    background: var(--op-surface); color: var(--op-text);
}
.op-frontend .op-ann-textadd { min-height: 44px; }
.op-frontend .op-ann-hint { margin: 0; text-align: center; font-size: 13px; color: var(--op-text-muted); }
/*
 * The hint of each tool in one cell, the others unseen: the line is as high
 * as the tallest hint at this width and in this language, so the photo does
 * not move when the tool changes (fix/annotate-bidi; it jumped 10 px on an
 * English phone, from two lines to one).
 */
.op-frontend .op-ann-hint { display: grid; }
.op-frontend .op-ann-hint > span { grid-area: 1 / 1; }
.op-frontend .op-ann-hint > [aria-hidden="true"] { visibility: hidden; }
.op-frontend .op-ann-hint[hidden] { display: none; }

.op-frontend .op-ann-tools,
.op-frontend .op-ann-actions {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
    gap: var(--op-sp-2) var(--op-sp-4);
}
.op-frontend .op-ann-tools[hidden] { display: none; }
.op-frontend .op-ann-actions { justify-content: space-between; }
.op-frontend .op-ann-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--op-sp-1); }
.op-frontend .op-ann-group[hidden] { display: none; }
.op-frontend .op-ann-end { margin-inline-start: auto; gap: var(--op-sp-2); }
.op-frontend .op-ann-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--op-sp-1);
    min-width: 44px; min-height: 44px;
    padding: 0 var(--op-sp-2);
    border: 1px solid var(--op-border); border-radius: var(--op-radius-sm);
    background: var(--op-surface); color: var(--op-text);
    font: inherit; font-size: 14px; cursor: pointer;
}
.op-frontend .op-ann-btn:hover:not(:disabled) { border-color: var(--op-border-strong); background: var(--op-bg); }
.op-frontend .op-ann-btn:focus-visible { outline: 2px solid var(--op-primary); outline-offset: 2px; }
.op-frontend .op-ann-btn:disabled { opacity: .45; cursor: default; }
/*
 * fix/photos18 (C17-PHO-09, b): the chosen tool, ink and thickness are
 * FILLED — teal behind a white icon — so a glance at the toolbar says what
 * the next stroke will be, without reading a name ("the highlight clearer").
 */
.op-frontend .op-ann-btn[aria-pressed="true"],
.op-frontend .op-ann-btn[aria-pressed="true"]:hover:not(:disabled) {
    border-color: var(--op-primary);
    background: var(--op-primary);
    color: #fff;
    box-shadow: 0 0 0 2px var(--op-primary-light);
}
/* A chosen ink: its swatch ringed in white on the fill, so red reads as red on teal. */
.op-frontend .op-ann-ink[aria-pressed="true"] .op-ann-swatch circle { stroke: var(--op-surface); stroke-width: 2.5; }
.op-frontend .op-ann-x { border-color: transparent; }
.op-frontend .op-ann-icon {
    width: 20px; height: 20px; flex: 0 0 auto;
    fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.op-frontend .op-ann-sizeicon { width: 22px; height: 22px; }
[dir="rtl"] .op-frontend .op-ann-flip, .op-frontend[dir="rtl"] .op-ann-flip { transform: scaleX(-1); }   /* undo points back, to the start of the line */
.op-frontend .op-ann-ink { padding: 0; }
.op-frontend .op-ann-swatch { width: 26px; height: 26px; }
.op-frontend .op-ann-swatch circle { stroke: var(--op-border-strong); stroke-width: 1.25; }
.op-frontend .op-ann-end .op-btn { min-height: 44px; display: inline-flex; align-items: center; gap: var(--op-sp-1); }
.op-frontend .op-ann-end .op-ann-icon { width: 18px; height: 18px; }
.op-frontend .op-ann-modal.is-readonly .op-ann-actions { justify-content: flex-end; }

.op-frontend .op-ann-ask {
    position: absolute; inset: auto var(--op-sp-4) var(--op-sp-4) var(--op-sp-4); z-index: 3;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--op-sp-3);
    padding: var(--op-sp-3) var(--op-sp-4);
    border: 1px solid var(--op-border-strong); border-radius: var(--op-radius);
    background: var(--op-surface); box-shadow: var(--op-shadow-lg);
}
.op-frontend .op-ann-ask[hidden] { display: none; }
.op-frontend .op-ann-ask-text { margin: 0; font-weight: 600; }
.op-frontend .op-ann-ask-btns { display: flex; flex-wrap: wrap; gap: var(--op-sp-2); margin-inline-start: auto; }
.op-frontend .op-ann-ask-btns .op-btn { min-height: 44px; }
.op-frontend .op-ann-askno { padding: 0 var(--op-sp-3); }
.op-frontend .op-ann-askyes { min-width: 44px; }

/* Wide: each tool says its name. Narrow: the icon, its name the tooltip and what a screen reader says. */
@media (max-width: 1023px) {
    .op-frontend .op-ann-tool .op-ann-name,
    .op-frontend .op-ann-history .op-ann-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* A phone: the editor is the whole screen, the photo first, the tools under it within reach of the thumb. */
@media (max-width: 767px) {
    .op-frontend .op-ann-modal { align-items: stretch; }
    .op-frontend .op-ann-box {
        width: 100vw; height: 100vh; height: 100dvh;
        padding: var(--op-sp-2) var(--op-sp-3) calc(var(--op-sp-3) + env(safe-area-inset-bottom, 0px));
        border-radius: 0;
    }
    .op-frontend .op-ann-title { font-size: 16px; line-height: 22px; }
    .op-frontend .op-ann-tools { gap: var(--op-sp-2); }
    .op-frontend .op-ann-actions { gap: var(--op-sp-2); }
    .op-frontend .op-ann-end { margin-inline-start: 0; flex: 1 1 auto; justify-content: flex-end; }
    .op-frontend .op-ann-ask { inset: auto var(--op-sp-2) var(--op-sp-2) var(--op-sp-2); }
    .op-frontend .op-ann-card .op-ann-figure { margin-top: var(--op-sp-2); }
    .op-frontend .op-ann-films { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/*
 * A phone held sideways (844 × 390, 667 × 375), or any window this short:
 * the photo cannot sit above two rows of tools, so the editor is the whole
 * screen with the photo at the start and the tools in a column beside it,
 * Save at its foot within the thumb's reach; the hint goes (the tools say
 * what they do). Right to left the column is on the left.
 */
@media (max-height: 540px) and (orientation: landscape) {
    .op-frontend .op-ann-modal { align-items: stretch; }
    .op-frontend .op-ann-box {
        display: grid;
        /* fix/board24 (M24-20): four thicknesses now — the thickness row and "Free angle · Straighten" still share one row. */
        grid-template-columns: minmax(0, 1fr) 284px;
        grid-template-rows: auto auto auto minmax(0, 1fr) auto;
        grid-template-areas: "note note" "stage head" "stage tools" "stage gap" "stage actions";
        column-gap: var(--op-sp-3); row-gap: 0;
        width: 100vw; height: 100vh; height: 100dvh;
        padding: var(--op-sp-2) calc(var(--op-sp-3) + env(safe-area-inset-right, 0px)) var(--op-sp-2) calc(var(--op-sp-3) + env(safe-area-inset-left, 0px));
        border-radius: 0;
        overflow-y: auto;       /* a screen shorter still (320 px): the column scrolls, nothing is cut off */
    }
    .op-frontend .op-ann-head { grid-area: head; gap: var(--op-sp-1); }
    .op-frontend .op-ann-title { font-size: 15px; line-height: 20px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .op-frontend .op-ann-note { grid-area: note; margin-bottom: var(--op-sp-2); padding: var(--op-sp-1) var(--op-sp-2); }
    .op-frontend .op-ann-stagewrap { grid-area: stage; min-width: 0; }
    .op-frontend .op-ann-hint { display: none; }
    .op-frontend .op-ann-tools { grid-area: tools; justify-content: flex-start; gap: var(--op-sp-1); margin-top: var(--op-sp-1); }
    .op-frontend .op-ann-tools .op-ann-group { gap: var(--op-sp-1); }
    .op-frontend .op-ann-actions { grid-area: actions; justify-content: flex-start; gap: var(--op-sp-1); }
    .op-frontend .op-ann-end { margin-inline-start: 0; flex: 1 1 auto; justify-content: space-between; gap: var(--op-sp-1); }
    .op-frontend .op-ann-tool .op-ann-name,
    .op-frontend .op-ann-history .op-ann-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .op-frontend .op-ann-ask { inset: auto var(--op-sp-2) var(--op-sp-2) var(--op-sp-2); }
}

/* ==========================================================================
   fix/photos18 (17 Nov call, C17-PHO-05 … 10)
   ========================================================================== */

/* C17-PHO-10: Diagnosis's "Draw and write" — a square button at the top of the step. */
.op-frontend .op-ann-launch {
    display: flex; align-items: center; gap: var(--op-sp-3);
    margin: 0 0 var(--op-sp-4);
}
.op-frontend .op-ann-tile {
    flex: 0 0 auto;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    width: 96px; height: 96px; box-sizing: border-box;
    padding: var(--op-sp-2);
    border: 1px solid var(--op-border-strong); border-radius: var(--op-radius);
    background: var(--op-surface); color: var(--op-text);
    font: inherit; text-align: center; cursor: pointer;
    text-decoration: none !important;
}
.op-frontend .op-ann-tile:hover { border-color: var(--op-primary); }
.op-frontend .op-ann-tile:focus-visible { outline: 2px solid var(--op-primary); outline-offset: 2px; }
.op-frontend .op-ann-tile-ic { display: inline-flex; width: 30px; height: 30px; margin-bottom: 4px; color: var(--op-primary); }
.op-frontend .op-ann-tile-ic svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.op-frontend .op-ann-tile-name { font-size: 13px; line-height: 17px; font-weight: 600; }
.op-frontend .op-ann-tile-count { font-size: 12px; line-height: 16px; color: var(--op-text-muted); }
.op-frontend .op-ann-tile.is-empty .op-ann-tile-ic { color: var(--op-text-muted); }
.op-frontend .op-ann-launch-say { margin: 0; max-width: 46ch; font-size: 13px; line-height: 18px; }

/* C17-PHO-08: "See what you drew in Diagnosis", on Clinical Steps' card. */
.op-frontend .op-ann-peek { min-height: 44px; display: inline-flex; align-items: center; gap: var(--op-sp-2); }

/* C17-PHO-10: between the whole montage and one photo, in the editor's head. */
.op-frontend .op-ann-pickwrap { position: relative; }
.op-frontend .op-ann-pickwrap[hidden] { display: none; }
.op-frontend .op-ann-chev { width: 16px; height: 16px; }
.op-frontend .op-ann-menu {
    position: absolute; z-index: 5; top: calc(100% + 4px); inset-inline-end: 0;
    min-width: 240px; max-width: min(320px, calc(100vw - 32px)); max-height: 60vh; overflow: auto;
    display: flex; flex-direction: column; padding: var(--op-sp-1);
    border: 1px solid var(--op-border); border-radius: var(--op-radius);
    background: var(--op-surface); box-shadow: var(--op-shadow-lg);
}
.op-frontend .op-ann-menu[hidden] { display: none; }
.op-frontend .op-ann-menuitem {
    display: flex; align-items: center; justify-content: space-between; gap: var(--op-sp-3);
    min-height: 44px; padding: 0 var(--op-sp-3);
    border: 0; border-radius: var(--op-radius-sm); background: none; color: var(--op-text);
    font: inherit; font-size: 14px; text-align: start; cursor: pointer;
}
.op-frontend .op-ann-menuitem:hover, .op-frontend .op-ann-menuitem:focus-visible { background: var(--op-bg); outline: none; }
.op-frontend .op-ann-menucount { font-size: 12px; color: var(--op-text-muted); white-space: nowrap; }

/* C17-PHO-05: × with marks not saved asks at the TOP, beside the ×, and the × shows it was pressed. */
.op-frontend .op-ann-ask.is-top {
    inset: auto; top: 56px; inset-inline-end: var(--op-sp-3);
    width: min(480px, calc(100% - 2 * var(--op-sp-3)));
    box-sizing: border-box;
}
.op-frontend .op-ann-x.is-asking { border-color: var(--op-primary); background: var(--op-primary-light); color: var(--op-primary); }

/* C17-PHO-06 / 07: Free angle and Straighten. */
.op-frontend .op-ann-free[aria-checked="true"] { border-color: var(--op-primary); background: var(--op-primary); color: #fff; }
.op-frontend .op-ann-btn[hidden] { display: none; }

/* C17-PHO-07: the fine turn's row, in the tools' place while it is open. */
.op-frontend .op-ann-tilt { display: flex; flex-direction: column; align-items: stretch; gap: var(--op-sp-2); width: min(640px, 100%); margin: 0 auto; }
.op-frontend .op-ann-tilt[hidden] { display: none; }
.op-frontend .op-ann-tilt-say { margin: 0; text-align: center; font-size: 13px; line-height: 18px; color: var(--op-text-muted); }
/* A turn is a direction on the photo, not in the line of text: −1° on the left, +1° on the right, in Arabic too. */
.op-frontend .op-ann-tilt-row { display: flex; align-items: center; gap: var(--op-sp-2); direction: ltr; }
.op-frontend .op-ann-tilt-range { flex: 1 1 auto; min-width: 0; height: 44px; margin: 0; accent-color: var(--op-primary); cursor: pointer; }
.op-frontend .op-ann-tilt-range:disabled { cursor: default; }
.op-frontend .op-ann-tilt-step { min-width: 52px; font-variant-numeric: tabular-nums; }
.op-frontend .op-ann-tilt-val {
    min-width: 56px; text-align: center; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums;
    direction: ltr; unicode-bidi: isolate;      /* "−4°" reads the same in Arabic */
}
.op-frontend .op-ann-tilt-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--op-sp-2); }
.op-frontend .op-ann-tilt-acts .op-btn { min-height: 44px; display: inline-flex; align-items: center; gap: var(--op-sp-1); }
.op-frontend .op-ann-tilt-acts .op-ann-icon { width: 18px; height: 18px; }
.op-frontend .op-ann-tilt-zero { margin-inline-end: auto; }
.op-frontend .op-ann-stage[data-tool="tilt"] .op-ann-draw { cursor: pointer; }
/* The grid to judge upright by, and on the whole montage the photos to pick from and the one picked. */
.op-frontend .op-ann-grid { pointer-events: none; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .65)); }
.op-frontend .op-ann-grid line { stroke-width: 1; stroke-opacity: .8; vector-effect: non-scaling-stroke; }
.op-frontend .op-ann-tiltcell { fill: none; stroke: var(--op-primary); stroke-width: 4; stroke-dasharray: 14 10; pointer-events: none; }
.op-frontend .op-ann-tiltsel { fill: none; stroke: var(--op-primary); stroke-width: 6; pointer-events: none; }

@media (max-width: 599px) {
    .op-frontend .op-ann-launch { gap: var(--op-sp-2); }
    .op-frontend .op-ann-head .op-ann-pick .op-ann-name,
    .op-frontend .op-ann-head .op-ann-whole2 .op-ann-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .op-frontend .op-ann-ask.is-top { inset-inline: var(--op-sp-2); width: auto; }
    .op-frontend .op-ann-tilt-acts { justify-content: space-between; }
    .op-frontend .op-ann-tilt-zero { margin-inline-end: 0; }
}
@media (max-width: 1023px) {
    .op-frontend .op-ann-more .op-ann-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-height: 540px) and (orientation: landscape) {
    .op-frontend .op-ann-tilt { grid-area: tools; margin: var(--op-sp-1) 0 0; }
    .op-frontend .op-ann-tilt-acts { justify-content: flex-start; }
    .op-frontend .op-ann-more .op-ann-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ==========================================================================
   fix/marks18 (C17-JUS-01, W22-05): the objectives and the plan as named
   markers — "From the plan" under the photo while that tool is chosen, its
   chips by row (each row edged in the Problem list's colour for it, as the
   Objectives card), the chosen one filled; a marker on the photo is a dot
   and its name on a soft halo (drawn in the ink chosen, as every mark).
   ========================================================================== */
.op-frontend .op-ann-tags {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--op-sp-1) var(--op-sp-3);
    max-height: 152px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
    width: min(1120px, 100%); margin: 0 auto; padding: 2px 0;
}
.op-frontend .op-ann-tags[hidden] { display: none; }
.op-frontend .op-ann-tagrow {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--op-sp-1);
    max-width: 100%;
    padding-inline-start: var(--op-sp-2);
    border-inline-start: 3px solid var(--op-border-strong);
}
.op-frontend .op-ann-tagrow-skeletal { border-inline-start-color: var(--op-pillar-skeletal); }
.op-frontend .op-ann-tagrow-dental { border-inline-start-color: var(--op-pillar-dental); }
.op-frontend .op-ann-tagrow-softTissue { border-inline-start-color: var(--op-pillar-soft); }
.op-frontend .op-ann-tagrow-plan { border-inline-start-color: var(--op-primary); }
.op-frontend .op-ann-tagcap { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--op-text-muted); margin-inline-end: var(--op-sp-1); }
.op-frontend .op-ann-tags .op-ann-tagchip {
    min-height: 44px; min-width: 44px; max-width: 100%; height: auto; margin: 0; padding-block: 4px;
    justify-content: center; white-space: normal; overflow-wrap: anywhere; line-height: 1.25;
}
.op-frontend .op-ann-tags-none { margin: 0; text-align: center; font-size: 13px; color: var(--op-text-muted); }
.op-frontend .op-ann-stage[data-tool="tag"] .op-ann-draw { cursor: copy; }
/* The marker's own parts are drawn on the photo, in its ink (svg_tag()); a tap goes to the drawing beneath. */
.op-frontend .op-ann-tagdot, .op-frontend .op-ann-tagname { pointer-events: none; }
/* Why a marker was not placed: in the photo's foot, as "the photo is full". */
.op-frontend .op-ann-status[data-ann-why] { background: var(--op-warning-bg); color: var(--op-warning-text); font-weight: 600; }

/* Justification: an objective unticked that has markers asks, under its row, whether they go too. */
.op-frontend .op-ann-dropask {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--op-sp-2) var(--op-sp-3);
    margin-top: var(--op-sp-2); padding: var(--op-sp-2) var(--op-sp-3);
    border-radius: var(--op-radius-sm);
    background: var(--op-warning-bg); color: var(--op-warning-text);
}
.op-frontend .op-ann-dropask-text { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.op-frontend .op-ann-dropask-btns { display: flex; flex-wrap: wrap; gap: var(--op-sp-2); margin-inline-start: auto; }
.op-frontend .op-ann-dropask-btns .op-btn { min-height: 44px; }
.op-frontend .op-ann-dropkeep, .op-frontend .op-ann-dropyes { white-space: nowrap; }

@media (max-width: 767px) {
    .op-frontend .op-ann-tags { max-height: 112px; justify-content: flex-start; }
}
/*
 * A phone held sideways: the column beside the photo is short (390 px), so
 * the chips get the room between the tools and Undo / Save — their own
 * scroll area, never under the actions — and, while "From the plan" is
 * chosen, the thickness row (a marker has none), Free angle / Straighten
 * and Download step aside for them (Undo, Clear and Save then share one
 * row); any other tool brings them back.
 */
@media (max-height: 540px) and (orientation: landscape) {
    .op-frontend .op-ann-tags {
        grid-area: gap; align-self: stretch; align-content: flex-start;
        max-height: none; min-height: 0; overflow-y: auto;
        margin: var(--op-sp-1) 0; padding: 2px 2px var(--op-sp-1);
    }
    .op-frontend .op-ann-tagcap { flex-basis: 100%; }
    .op-frontend .op-ann-box[data-ann-on="tag"] .op-ann-sizes,
    .op-frontend .op-ann-box[data-ann-on="tag"] .op-ann-more,
    .op-frontend .op-ann-box[data-ann-on="tag"] .op-ann-download { display: none; }
}

@media print {
    .op-frontend .op-ann-modal { display: none !important; }
    .op-frontend .op-ann-hit { display: none; }
    .op-frontend .op-ann-launch { display: none; }
}

/* ==========================================================================
   fix/board24 (24 Nov call)
   ========================================================================== */

/* M24-21: "Tracing" on the film, and its readings in a narrow panel at the film's side. */
.op-frontend .op-ann-trace[hidden] { display: none; }
/*
 * On: the info tint behind dark info ink. .op-ann-btn.op-ann-trace outranks the
 * chosen-tool fill (.op-ds .op-ann-btn[aria-pressed] sets white ink, calm base),
 * which would leave white on the pale tint (1.1:1).
 */
.op-frontend .op-ann-btn.op-ann-trace[aria-pressed="true"],
.op-frontend .op-ann-btn.op-ann-trace[aria-pressed="true"]:hover:not(:disabled) { background: var(--ds-info-bg, #edf3f7); border-color: var(--ds-info, #4d7697); color: var(--ds-info-text, #355d7b); box-shadow: none; }
.op-frontend .op-ann-modal.is-tracing .op-ann-stagewrap { gap: 8px; }
.op-frontend .op-ann-ceph {
    flex: 0 0 auto;
    align-self: stretch;
    width: 264px;
    max-width: 42%;
    overflow-y: auto;
    padding: 6px 8px;
    border: 1px solid var(--ds-line, #dfe4e7);
    border-radius: var(--op-radius-sm, 6px);
    background: var(--ds-surface, #ffffff);
    color: var(--ds-ink, #131d23);
    font-size: 12px;
    line-height: 16px;
}
.op-frontend .op-ann-ceph[hidden] { display: none; }
.op-frontend .op-ann-ceph.is-folded { width: 48px; padding: 2px; overflow: hidden; }
.op-frontend .op-ann-ceph-fold {
    display: flex; align-items: center; justify-content: space-between; gap: 4px;
    width: 100%; min-height: 44px; padding: 0 6px;
    font-weight: 700; font-size: 12px;
}
.op-frontend .op-ann-ceph.is-folded .op-ann-ceph-fold { flex-direction: column; justify-content: center; padding: 6px 0; height: 100%; }
.op-frontend .op-ann-ceph.is-folded .op-ann-ceph-cap { writing-mode: vertical-rl; }
.op-frontend .op-ann-ceph-fold .op-ann-chev { width: 16px; height: 16px; transform: rotate(-90deg); }
.op-frontend .op-ann-ceph.is-folded .op-ann-ceph-fold .op-ann-chev { transform: rotate(90deg); }
[dir="rtl"] .op-frontend .op-ann-ceph-fold .op-ann-chev,
.op-frontend[dir="rtl"] .op-ann-ceph-fold .op-ann-chev { transform: rotate(90deg); }
.op-frontend .op-ann-ceph-title { margin: 4px 0; font-weight: 700; color: var(--ds-ink-2, #4a5761); }
.op-frontend .op-ann-ceph-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.op-frontend .op-ann-ceph-table th,
.op-frontend .op-ann-ceph-table td { padding: 3px 2px; border-bottom: 1px solid var(--ds-line, #dfe4e7); text-align: start; vertical-align: top; }
.op-frontend .op-ann-ceph-table thead th { font-weight: 600; color: var(--ds-ink-3, #5f6c75); }
.op-frontend .op-ann-ceph-table tbody th { font-weight: 600; }
.op-frontend .op-ann-ceph-table td { white-space: nowrap; }
.op-frontend .op-ann-ceph-table tr[data-status="increased"] td:nth-child(2),
.op-frontend .op-ann-ceph-table tr[data-status="decreased"] td:nth-child(2) { color: var(--ds-danger-text, #a3352f); font-weight: 700; }
.op-frontend .op-ann-ceph-note { margin: 6px 0 0; color: var(--ds-ink-3, #5f6c75); }
.op-frontend .op-ann-ceph-none { margin: 4px 0 8px; }
.op-frontend .op-ann-ceph-go { min-height: 44px; display: inline-flex; align-items: center; }
.op-frontend .op-ann-tracelayer { pointer-events: none; }
/*
 * A phone: the readings under the film, the screen's whole width (beside it the
 * table had 170 px and its Norm column was cut off, the film 186 px wide);
 * folded, a 44 px bar under the film.
 */
@media (max-width: 600px) {
    .op-frontend .op-ann-modal.is-tracing .op-ann-stagewrap { flex-direction: column; justify-content: flex-start; }
    .op-frontend .op-ann-ceph { flex: 0 1 auto; width: 100%; max-width: none; max-height: 38%; min-height: 0; font-size: 12px; line-height: 15px; }
    .op-frontend .op-ann-ceph.is-folded { width: 100%; height: auto; flex: 0 0 auto; }
    .op-frontend .op-ann-ceph-title { display: none; }   /* the bar says Readings; the rows have the room */
    .op-frontend .op-ann-ceph.is-folded .op-ann-ceph-fold { flex-direction: row; justify-content: space-between; padding: 0 6px; height: auto; }
    .op-frontend .op-ann-ceph.is-folded .op-ann-ceph-cap { writing-mode: horizontal-tb; }
    .op-frontend .op-ann-ceph .op-ann-ceph-fold .op-ann-chev,
    [dir="rtl"] .op-frontend .op-ann-ceph .op-ann-ceph-fold .op-ann-chev,
    .op-frontend[dir="rtl"] .op-ann-ceph .op-ann-ceph-fold .op-ann-chev { transform: none; }
    .op-frontend .op-ann-ceph.is-folded .op-ann-ceph-fold .op-ann-chev,
    [dir="rtl"] .op-frontend .op-ann-ceph.is-folded .op-ann-ceph-fold .op-ann-chev,
    .op-frontend[dir="rtl"] .op-ann-ceph.is-folded .op-ann-ceph-fold .op-ann-chev { transform: rotate(180deg); }
}
