/* ============================================================
   OrthoPlan Pro — shared components (6 Nov 2026, package F2)
   Loaded after public.css (OrthoPlan_Public::module_assets()).
   Tokens only, logical properties only: it is read in Arabic too.
   ============================================================ */

/* ---------- Pillar chrome (R-SYS-11) ----------
   Skeletal, Dental and Soft tissue colour the section's header band and tint
   and nothing else. They never mark a tooth, and they are none of red, green,
   amber or teal, because those mean a Class or a status on the same screens. */
.op-frontend .op-pillar-skeletal { --op-pillar: var(--op-pillar-skeletal); --op-pillar-tint: var(--op-pillar-skeletal-bg); }
.op-frontend .op-pillar-dental   { --op-pillar: var(--op-pillar-dental);   --op-pillar-tint: var(--op-pillar-dental-bg); }
.op-frontend .op-pillar-soft     { --op-pillar: var(--op-pillar-soft);     --op-pillar-tint: var(--op-pillar-soft-bg); }
.op-frontend .op-fsec-head.op-pillar-head {
    border-inline-start-color: var(--op-pillar);
    background: var(--op-pillar-tint);
    padding-block: var(--op-sp-2);
    padding-inline-end: var(--op-sp-3);
    border-radius: var(--op-radius-sm);
}
/* Body text on a tint keeps its contrast: the band is tinted, the words are not. */
.op-frontend .op-pillar-head .op-fsec-title { color: var(--op-text); }
.op-frontend .op-problem-card.op-accent-skeletal { border-inline-start-color: var(--op-pillar-skeletal); }
.op-frontend .op-problem-card.op-accent-dental   { border-inline-start-color: var(--op-pillar-dental); }
.op-frontend .op-problem-card.op-accent-soft     { border-inline-start-color: var(--op-pillar-soft); }

/* ---------- Gold is the hover, on an unselected chip only (R-SYS-11) ----------
   Teal is "selected", so a teal hover read as a chip already chosen. Only
   where there is a pointer that hovers: on a touch screen a tapped chip kept
   the gold until the next tap elsewhere (R-DIA-03; the rest of the chip
   states are in op-diagnosis.css). */
@media (hover: hover) {
    .op-frontend .op-chip:not(.is-active):hover:not(:disabled) {
        background: var(--op-accent-light) !important;
        border-color: var(--op-accent) !important;
        color: var(--op-accent-text) !important;
    }
}

/* ---------- The Switch pen on a chart: teal, like its swatch ---------- */
.op-frontend .op-tc-tooth.op-tc-tone-primary.is-on .op-tc-crown { fill: var(--op-mark-switch); stroke: var(--op-primary-dark); }
.op-frontend .op-tc-tooth.op-tc-tone-primary.is-on .op-tc-num   { color: var(--op-primary-dark); }
.op-frontend .op-tc-tone-primary > .op-tc-swatch { background: var(--op-mark-switch); }

/* ---------- '+ Add one of your own' (R-SYS-10) ---------- */
/* A one-off: on this case, not in his list. Dashed, with words in its title. */
.op-frontend .op-chip.is-oneoff { border-style: dashed !important; }
/* fix/complete (R16-07): an option whose meaning is still our proposal (the Mechanics row) carries the proposal mark,
   as "Our proposal — edit it" does: the warning's 6 px dot after its name, and the key under the row in its words. */
.op-frontend .op-chip.is-proposed::after { content: ''; display: inline-block; flex: none; width: 6px; height: 6px; margin-inline-start: 6px; vertical-align: middle; border-radius: 50%; background: var(--op-warning); }
.op-frontend .op-field .op-chip-proposed-key { display: flex; align-items: center; gap: 6px; color: var(--op-warning-text); }
.op-frontend .op-chip-proposed-key::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--op-warning); }
.op-ds .op-chip.is-proposed::after, .op-ds .op-chip-proposed-key::before { background: var(--ds-warning); }
.op-ds .op-field .op-chip-proposed-key { color: var(--ds-warning-text); }
.op-frontend .op-addopt-sizes { flex: 1 1 160px; min-width: 0; }
.op-frontend .op-addopt-kind  { flex: 0 1 190px; min-width: 0; }
.op-frontend .op-addopt-colours { display: flex; flex-wrap: wrap; gap: 6px; }
.op-frontend .op-addopt-colour {
    inline-size: 32px;
    block-size: 32px;
    padding: 0;
    border-radius: 50%;
    border: 3px solid var(--op-surface);
    background: var(--op-swatch);
    box-shadow: 0 0 0 1px var(--op-border-strong);
    cursor: pointer;
}
.op-frontend .op-addopt-colour.is-active { box-shadow: 0 0 0 2px var(--op-text); }
.op-frontend .op-slot-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--op-sp-2); }
.op-frontend .op-slot-list:empty { display: none; }
.op-frontend .op-addopt-slot {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 var(--op-sp-3);
    border: 1.5px solid var(--op-border-strong);
    border-radius: var(--op-radius);
    background: var(--op-surface);
    font-size: 12.5px;
    font-weight: 600;
}

/* ---------- City, the combobox variant (R-CLI-03) ---------- */
/* A text box that offers the list as he types: it shrinks with its grid
   cell like every other field rather than holding the row open. */
.op-frontend .op-field-combobox { min-width: 0; }
.op-frontend .op-field-combobox .op-input { width: 100%; }

/* ---------- The quick tooth picker (R-SYS-12) ----------
   A picture of the mouth, like the chart: the patient's right on the viewer's
   left in every language, so the grid is laid out left-to-right always and
   the words inside each tile follow the page.

   fix/teeth18 (C17-DIA-02, W22-04): «صغّرها … ربع الحجم ده» and «الترقيم …
   من ناحية الخط … في نفس الخط، مش سطرين». One row of eight a quadrant,
   numbered from the midline outward: UR 8…1 | UL 1…8 above the dashed arch
   line, LR 8…1 | LL 1…8 below it, the 1s meeting at a dashed midline, and
   each quadrant's name, the Whole quadrant tick, at its far end. About a
   quarter of the 3.4.0 picker's area (a third at most), on the tablet and
   the computer.
   A quarter of the size and a thumb's 44 px are both kept: a tooth is drawn
   as a small box (24 px; 28 × 30 on a touch screen) inside a button that is
   the target (26 px; 32 wide × 44 tall on a touch screen or up to 1024 px). The buttons touch
   one another, so the boxes stand apart while every bit of the row is some
   tooth's target, and the upper and lower rows' targets meet at the arch
   line. Too narrow for both sides on one line (a phone): the right half
   (UR over LR) then the left (UL over LL), each quadrant still one row of
   eight in midline order, its name above or below it as on a chart; under
   8 × 32 px each quadrant takes two rows of four, front teeth first.

   fix/ceph24 (M24-13): «هو ده الشكل اللي احنا عاوزينه فعلا … وصغرها. بصغر
   كمان». The Crossbite layout everywhere (UR | UL on one line, LR | LL under
   it), smaller still: a computer's tooth 24 px (was 26), a touch screen's
   32 × 36 (was 32 × 44: the acceptance's 32 px floor), the quadrant's name
   36 px. Where both halves do not fit beside their names (a tablet in
   portrait, Diagnosis' finding tiles: 516–591 px), the names go above the
   upper teeth and under the lower ones and the teeth stay on two lines;
   only under 516 px (a phone) does the picker split into halves. */
.op-frontend .op-tpick-field { min-width: 0; }
.op-frontend .op-tpick {
    --op-tp-w: 24px;       /* a tooth's target */
    --op-tp-h: 24px;
    --op-tp-box-w: 22px;   /* the box drawn inside it */
    --op-tp-box-h: 22px;
    --op-tp-head: 40px;    /* the quadrant's name and its tick */
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    align-items: flex-start;   /* the page's start: left in English, right in Arabic */
    min-width: 0;
}
/* A touch screen, and any screen up to 1024 px (the plugin's touch floor, measure/F4): a thumb's target. */
@media (pointer: coarse), (max-width: 1024px) {
    .op-frontend .op-tpick { --op-tp-w: 32px; --op-tp-h: 36px; --op-tp-box-w: 26px; --op-tp-box-h: 28px; --op-tp-head: 36px; }
}
.op-frontend .op-tpick-quads {
    display: grid;
    grid-template-columns: max-content max-content;
    max-width: 100%;
    direction: ltr;
    unicode-bidi: isolate;
}
.op-frontend .op-tpick-quad {
    display: grid;
    grid-template-columns: var(--op-tp-head) max-content;
    align-items: center;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
}
/* The far end: UR and LR on the left, UL and LL on the right. */
.op-frontend .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) { grid-template-columns: max-content var(--op-tp-head); }
.op-frontend .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) > .op-tpick-head { order: 2; }
/* The midline and the arch line: dashed, as on the drawn charts. */
.op-frontend .op-tpick-quad:is([data-quad="ur"], [data-quad="lr"]) > .op-tpick-pos { padding-right: 4px; border-right: 1px dashed var(--op-border-strong); }
.op-frontend .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) > .op-tpick-pos { padding-left: 4px; }
.op-frontend .op-tpick-quad:is([data-quad="ur"], [data-quad="ul"]) { border-bottom: 1px dashed var(--op-border-strong); }
/* A computer's 26 px teeth: 2 px either side of the arch line, so the boxes never sit on it. */
@media (pointer: fine) and (min-width: 1025px) {
    .op-frontend .op-tpick-quad:is([data-quad="ur"], [data-quad="ul"]) { padding-bottom: 2px; }
    .op-frontend .op-tpick-quad:is([data-quad="lr"], [data-quad="ll"]) { padding-top: 2px; }
}
.op-frontend .op-tpick-head { display: flex; align-items: center; min-width: 0; }
.op-frontend .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) > .op-tpick-head { justify-content: flex-end; }
/* The words inside the name follow the page's direction. */
[dir="rtl"] .op-frontend .op-tpick-whole { direction: rtl; }
.op-frontend .op-tpick-whole {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: var(--op-tp-head);
    min-height: var(--op-tp-h);
    font-size: 12px;
    color: var(--op-text-muted);
    cursor: pointer;
    white-space: nowrap;
}
.op-frontend .op-tpick-whole input { margin: 0; accent-color: var(--op-primary); }
.op-frontend .op-tpick .op-quadrant-label { font-weight: 600; color: var(--op-text); }
/* The teeth keep to the midline whatever the width of the name beside them. */
.op-frontend .op-tpick-quad:is([data-quad="ur"], [data-quad="lr"]) { justify-content: end; }
.op-frontend .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) { justify-content: start; }
/* The words come back where the row has room for them: a computer (a mouse and
   a wide card). A touch screen keeps the compact name, as on the tablet. */
.op-frontend .op-tpick-whole-words { display: none; }
@media (hover: hover) and (pointer: fine) {
    @container (min-width: 900px) {
        .op-frontend .op-tpick-quads > .op-tpick-quad { grid-template-columns: max-content max-content; }
        .op-frontend .op-tpick-quad:is([data-quad="ur"], [data-quad="lr"]) > .op-tpick-head { padding-right: 8px; }
        .op-frontend .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) > .op-tpick-head { padding-left: 8px; }
        .op-frontend .op-tpick-whole-words { display: inline; }
    }
}
.op-frontend .op-tpick-pos { display: flex; direction: ltr; min-width: 0; }
.op-frontend .op-tpick-chip {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 var(--op-tp-w);
    width: var(--op-tp-w);
    height: var(--op-tp-h);
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
}
.op-frontend .op-tpick-chip:disabled { cursor: default; }
.op-frontend .op-tpick-n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: var(--op-tp-box-w);
    height: var(--op-tp-box-h);
    border: 1px solid var(--op-border);
    border-radius: 6px;
    background: var(--op-surface);
    color: var(--op-text-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: background-color var(--op-transition), border-color var(--op-transition), color var(--op-transition);
}
@media (hover: hover) {
    .op-frontend .op-tpick-chip:not(:disabled):not(.is-active):hover .op-tpick-n { border-color: var(--op-primary); color: var(--op-text); }
}
.op-frontend .op-tpick-chip.is-active .op-tpick-n {
    background: var(--op-primary);
    border-color: var(--op-primary);
    color: var(--op-primary-text);
}
.op-frontend .op-tpick-chip:disabled .op-tpick-n { opacity: .55; }
.op-frontend .op-tpick-chip:focus-visible { outline: none; }
.op-frontend .op-tpick-chip:focus-visible .op-tpick-n { outline: 2px solid var(--op-primary); outline-offset: 1px; }

/* fix/ceph24 (M24-13): too narrow for the names beside the teeth, wide enough
   for sixteen teeth: the names above the upper teeth and under the lower. */
@container (min-width: 516px) and (max-width: 591px) {
    .op-frontend .op-tpick-quads > .op-tpick-quad { grid-template-columns: max-content; }
    .op-frontend .op-tpick-quads > .op-tpick-quad:is([data-quad="ur"], [data-quad="ul"]) > .op-tpick-head { order: 0; }
    .op-frontend .op-tpick-quads > .op-tpick-quad:is([data-quad="lr"], [data-quad="ll"]) > .op-tpick-head { order: 2; }
    .op-frontend .op-tpick-quads > .op-tpick-quad > .op-tpick-head .op-tpick-whole { min-height: 32px; }
}
/* A phone: the right half, then the left. */
@container (max-width: 515px) {
    .op-frontend .op-tpick-quads { grid-template-columns: minmax(0, 1fr); width: 100%; }
    .op-frontend .op-tpick-quad[data-quad="ur"] { order: 1; }
    .op-frontend .op-tpick-quad[data-quad="lr"] { order: 2; }
    .op-frontend .op-tpick-quad[data-quad="ul"] { order: 3; margin-top: var(--op-sp-3); }
    .op-frontend .op-tpick-quad[data-quad="ll"] { order: 4; }
    .op-frontend .op-tpick-quad,
    .op-frontend .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) { grid-template-columns: minmax(0, 1fr); }
    .op-frontend .op-tpick-quad[data-quad="ul"] > .op-tpick-head { order: 0; }
    /* Lower quadrants: the name under the teeth, as on a chart. */
    .op-frontend .op-tpick-quad:is([data-quad="lr"], [data-quad="ll"]) > .op-tpick-head { order: 2; }
    .op-frontend .op-tpick-whole-words { display: inline; }
    .op-frontend .op-tpick-whole-words::before { content: '· '; }
    /* The 1s at the midline: the right half's row ends at it, the left half's starts there. */
    .op-frontend .op-tpick-quad:is([data-quad="ur"], [data-quad="lr"]) > .op-tpick-pos { justify-content: flex-end; }
    .op-frontend .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) > .op-tpick-pos { justify-content: flex-start; border-left: 1px dashed var(--op-border-strong); }
    .op-frontend .op-tpick-chip { flex: 1 1 0; width: auto; min-width: var(--op-tp-w); max-width: 44px; }
    .op-frontend .op-tpick-n { width: calc(100% - 4px); max-width: 36px; }
}
/* Under 8 teeth of room: two rows of four, front teeth first, still in midline
   order, the quadrant's name beside them at its far end (the rows are short now).
   A touch screen's 32 px teeth need 8 × 32 + 5 px, a computer's 26 px teeth only
   8 × 26 + 5, so on a computer Diagnosis' finding tiles (245 px at 1440) keep
   one row of eight (teeth18 review: the 270 px rule alone split them there). */
@media (pointer: coarse), (max-width: 1024px) {
    @container (max-width: 270px) {
        .op-frontend .op-tpick-quads > .op-tpick-quad:is([data-quad="ur"], [data-quad="lr"]) { grid-template-columns: var(--op-tp-head) minmax(0, 1fr); }
        .op-frontend .op-tpick-quads > .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) { grid-template-columns: minmax(0, 1fr) var(--op-tp-head); }
        .op-frontend .op-tpick-quads > .op-tpick-quad:is([data-quad="ur"], [data-quad="lr"]) > .op-tpick-head { order: 0; }
        .op-frontend .op-tpick-quads > .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) > .op-tpick-head { order: 2; }
        .op-frontend .op-tpick-whole-words { display: none; }
        .op-frontend .op-tpick-pos { flex-wrap: wrap; }
        .op-frontend .op-tpick-chip { flex: 0 0 25%; max-width: none; }
        .op-frontend .op-tpick-quad:is([data-quad="ur"], [data-quad="lr"]) .op-tpick-chip:is([data-tooth$="1"], [data-tooth$="2"], [data-tooth$="3"], [data-tooth$="4"]) { order: -1; }
    }
}
@container (max-width: 215px) {
    .op-frontend .op-tpick-quads > .op-tpick-quad:is([data-quad="ur"], [data-quad="lr"]) { grid-template-columns: var(--op-tp-head) minmax(0, 1fr); }
    .op-frontend .op-tpick-quads > .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) { grid-template-columns: minmax(0, 1fr) var(--op-tp-head); }
    .op-frontend .op-tpick-quads > .op-tpick-quad:is([data-quad="ur"], [data-quad="lr"]) > .op-tpick-head { order: 0; }
    .op-frontend .op-tpick-quads > .op-tpick-quad:is([data-quad="ul"], [data-quad="ll"]) > .op-tpick-head { order: 2; }
    .op-frontend .op-tpick-whole-words { display: none; }
    .op-frontend .op-tpick-pos { flex-wrap: wrap; }
    .op-frontend .op-tpick-chip { flex: 0 0 25%; max-width: none; }
    .op-frontend .op-tpick-quad:is([data-quad="ur"], [data-quad="lr"]) .op-tpick-chip:is([data-tooth$="1"], [data-tooth$="2"], [data-tooth$="3"], [data-tooth$="4"]) { order: -1; }
}
.op-frontend .op-tpick-readout {
    margin-top: 4px;   /* fix/ceph24 (M24-13): tight under the teeth */
    font-size: 12.5px;
    font-weight: 600;
    color: var(--op-text);
}
.op-frontend .op-tpick-readout:empty { display: none; }

/* ---------- Linked cards and Modify (R-SYS-14) ---------- */
.op-frontend .op-linked-card.has-modify { position: relative; padding-inline-end: 84px; }
.op-frontend .op-linked-card .op-modify {
    position: absolute;
    inset-block-start: 6px;
    inset-inline-end: 6px;
    min-height: 32px;
}
.op-frontend .op-fsec-head .op-modify { margin-inline-start: auto; }
.op-frontend .op-fsec-head:has(.op-modify) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--op-sp-3); }
.op-frontend .op-fsec-head:has(.op-modify) .op-fsec-sub { flex-basis: 100%; }

/* Where a Modify lands: clear of the sticky top bar, and shown for a moment,
   because a jump into the middle of a long step is easy to lose. */
.op-frontend [data-op-anchor] { scroll-margin-top: calc(var(--op-topbar-height) + var(--op-sp-4)); }
.op-frontend .op-anchor-flash { animation: op-anchor-flash 1.6s ease-out 1; }
@keyframes op-anchor-flash {
    0%, 30% { box-shadow: 0 0 0 3px var(--op-accent); border-radius: var(--op-radius-sm); }
    100%    { box-shadow: 0 0 0 3px transparent; }
}
@media (prefers-reduced-motion: reduce) {
    .op-frontend .op-anchor-flash { animation: none; outline: 3px solid var(--op-accent); }
}

/* ---------- fix/pln-line: deleting what he added (R11-SYS-04) ----------
   His own entry's chip carries an × joined to its end; a dropdown's, a slot's
   or a pen's are listed as "Yours:" beside the '+'. Built-in entries carry
   none. A finger-sized × on a touch screen. */
.op-frontend .op-chip.is-own {
    border-start-end-radius: 0 !important;
    border-end-end-radius: 0 !important;
}
.op-frontend .op-own-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    min-height: 32px;
    padding: 0 6px;
    margin-inline-start: -6px;
    border: 1.5px solid var(--op-border-strong);
    border-start-start-radius: 0;
    border-end-start-radius: 0;
    border-start-end-radius: var(--op-radius);
    border-end-end-radius: var(--op-radius);
    background: var(--op-surface);
    color: var(--op-text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
/* The chip and its × as one unit: never split across two lines. */
.op-frontend .op-own-pair { display: inline-flex; align-items: stretch; flex-wrap: nowrap; max-width: 100%; }
.op-frontend .op-own-pair > .op-own-x { margin-inline-start: 0; border-inline-start-width: 0; }
.op-frontend .op-own-x:hover,
.op-frontend .op-own-x:focus-visible { color: var(--op-danger-text); border-color: var(--op-danger); }
.op-frontend .op-addopt-own {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: var(--op-sp-2);
    font-size: 13px;
}
.op-frontend .op-addopt-own-cap { color: var(--op-text-muted); font-weight: 600; }
.op-frontend .op-own-tag {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding-inline-start: 10px;
    border: 1px dashed var(--op-border-strong);
    border-radius: var(--op-radius);
    background: var(--op-surface);
}
/* A word never breaks letter by letter (it did in the narrow X-ray tile). */
.op-frontend .op-own-tag > bdi { min-width: 0; overflow-wrap: break-word; }
/* Where the '+' lays its parts in a row (the X-ray slot), "Yours:" takes a line of its own above it. */
.op-frontend .op-addopt:has(> .op-addopt-own) { flex-wrap: wrap; }
.op-frontend .op-addopt > .op-addopt-own { flex: 1 0 100%; }
.op-frontend .op-own-tag .op-own-x { margin-inline-start: 2px; border: 0; background: none; }
@media (pointer: coarse) {
    .op-frontend .op-own-x { min-width: 44px; min-height: 44px; }
}

