/* ============================================================
   OrthoPlan Pro — Diagnosis and Justification (6 Nov 2026, package DIA)
   Loaded after public.css and op-components.css (name order).
   Tokens only, logical properties only: it is read in Arabic too.
   ============================================================ */

/* ---------- Chip states, on every chip in the system (R-DIA-03) ----------
   "When I stop on an option it turns green, so I cannot tell — I thought
   Decrease was already chosen … make the hover another colour."

   Teal fill is "selected" and nothing else. Hovering an unselected chip is
   the gold tint (op-components.css, R-SYS-11). Hovering a selected chip
   leaves it looking selected, its white label readable — the old teal hover
   painted that label teal on teal and it vanished. A class-coloured chip
   keeps its class colour under the pointer. On a touch screen there is no
   hover at all, so a tapped chip is only ever selected or not. */
@media (hover: hover) {
    .op-frontend .op-chip.is-active:hover:not(:disabled) {
        box-shadow: 0 0 0 3px var(--op-accent-light);
    }
    .op-frontend .op-chip.op-chip-success:not(.is-active):hover:not(:disabled) { border-color: #9cd8bf !important; color: var(--op-success-text) !important; }
    .op-frontend .op-chip.op-chip-warn:not(.is-active):hover:not(:disabled)    { border-color: #f0c48c !important; color: var(--op-warning-text) !important; }
    .op-frontend .op-chip.op-chip-danger:not(.is-active):hover:not(:disabled)  { border-color: #f0a9a9 !important; color: var(--op-danger-text) !important; }
    .op-frontend .op-chip.op-chip-info:not(.is-active):hover:not(:disabled)    { border-color: #a6c8f2 !important; color: var(--op-info-text) !important; }
}
/* Keyboard focus: a blue ring, which is neither selected nor hover. */
.op-frontend .op-chip:focus-visible { outline: 2px solid var(--op-info); outline-offset: 2px; }

/* ---------- The three pillars, each its own box (R-DIA-01, R-DIA-02) ----------
   "Each in a highlighted box with its own colour." The card is edged and
   tinted at the top in its pillar's colour; the header band is F2's
   (op-components.css). Chrome only: the words keep the text colour. */
.op-frontend .op-card.op-pillar-card {
    border: 1.5px solid var(--op-pillar-tint);
    border-top: 4px solid var(--op-pillar);
}
/* Card title > sub-block heading > field label. */
.op-frontend .op-pillar-card > .op-fsec-head .op-fsec-title { font-size: 17px; font-weight: 800; }

/* The Dental card's sub-blocks: each with a heading, the first flush under the card head. */
.op-frontend .op-dx-block > .op-fsub { margin-top: 0; padding-inline-start: var(--op-sp-2); border-inline-start: 3px solid var(--op-pillar); }
.op-frontend .op-pillar-card > .op-fsec-head + .op-dx-block { margin-top: 0; padding-top: 0; border-top: 0; }
.op-frontend .op-dx-block > .op-field-grid + .op-field-grid { margin-top: var(--op-sp-4); }

/* The incisor row: three equal cells, each mm dropdown under its own chips. */
.op-frontend .op-dx-incisor { align-items: stretch; }
.op-frontend .op-dx-incisor > .op-measure-card { margin-bottom: 0; justify-content: flex-start; }

/* ---------- Functional shift, the VIP tile set on Patient Photos (R-DIA-07) ---------- */
.op-frontend .op-feature-shift .op-check-tile.is-mirror { cursor: default; }
.op-frontend .op-feature-shift .op-check-tile.is-mirror input { opacity: 1; }
.op-frontend .op-feature-state { margin-inline-start: auto; font-weight: 800; }
.op-frontend .op-feature-shift .op-modify { justify-self: start; }
.op-frontend .op-shift-details { margin-top: var(--op-sp-3); }
.op-frontend .op-shift-details[hidden] { display: none; }

/* ---------- The buccal segment, grouped by class ----------
   Right and left side by side; in each, Class I | Class II | Class III as
   captioned groups in the class colours, and the value chosen repeated in
   the side's header. */
.op-frontend .op-dx-buccal { align-items: stretch; }
.op-frontend .op-bs-side { min-width: 0; }
.op-frontend .op-bs-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--op-sp-2);
    font-size: 13px;
    color: var(--op-text);
}
.op-frontend .op-bs-chosen { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.op-frontend .op-bs-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--op-radius-pill);
    border: 1.5px solid var(--op-border-strong);
    background: var(--op-surface);
    font-size: 12.5px;
    font-weight: 800;
    color: var(--op-text);
}
.op-frontend .op-bs-badge[hidden] { display: none; }
.op-frontend .op-bs-badge-k { font-size: 11px; font-weight: 700; color: var(--op-text-muted); }
.op-frontend .op-bs-badge-success { border-color: var(--op-success); background: var(--op-success-bg); color: var(--op-success-text); }
.op-frontend .op-bs-badge-warn    { border-color: var(--op-warning); background: var(--op-warning-bg); color: var(--op-warning-text); }
.op-frontend .op-bs-badge-danger  { border-color: var(--op-danger);  background: var(--op-danger-bg);  color: var(--op-danger-text); }
.op-frontend .op-bs-badge-v { direction: ltr; unicode-bidi: isolate; }

.op-frontend .op-chips-grouped { gap: var(--op-sp-2); align-items: stretch; }
.op-frontend .op-chip-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--op-border);
    border-radius: var(--op-radius);
    background: var(--op-bg);
    min-width: 0;
}
.op-frontend .op-chip-group-cap {
    flex-basis: 100%;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.op-frontend .op-chip-group-success { border-color: #9cd8bf; background: var(--op-success-bg); }
.op-frontend .op-chip-group-warn    { border-color: #f0c48c; background: var(--op-warning-bg); }
.op-frontend .op-chip-group-danger  { border-color: #f0a9a9; background: var(--op-danger-bg); }
.op-frontend .op-chip-group-success > .op-chip-group-cap { color: var(--op-success-text); }
.op-frontend .op-chip-group-warn    > .op-chip-group-cap { color: var(--op-warning-text); }
.op-frontend .op-chip-group-danger  > .op-chip-group-cap { color: var(--op-danger-text); }

/* ---------- Rotations: No / Yes on one line (R-DIA-11) ---------- */
.op-frontend .op-dx-yesno { display: flex; flex-wrap: wrap; align-items: center; gap: var(--op-sp-2) var(--op-sp-4); }
.op-frontend .op-dx-yesno > .op-fsub { margin-bottom: 0; }
.op-frontend .op-dx-yesno > .op-field { margin-bottom: 0; }
.op-frontend .op-dx-yesno + .op-reveal { margin-top: var(--op-sp-3); }

/* ---------- Export your diagnosis (R-DIA-18) ---------- */
.op-frontend .op-export-dx strong { font-weight: 800; }

/* ---------- The summary, row by row in its pillar (R-DIA-02) ---------- */
.op-frontend .op-summary-row.op-pillar-row {
    border-inline-start: 3px solid var(--op-pillar);
    padding-inline-start: var(--op-sp-2);
}

/* ---------- The problem list, on Justification (R-DIA-16) ----------
   "So that all of this is found, we have a hero like this and under it a
   sub-text … each one a group." Three blocks in the pillar tints, one
   numbering through all three. */
.op-frontend .op-plist { counter-reset: op-problem; display: flex; flex-direction: column; gap: var(--op-sp-3); margin-bottom: var(--op-sp-3); }
.op-frontend .op-pgroup {
    padding: var(--op-sp-3) var(--op-sp-4) var(--op-sp-2);
    border-inline-start: 4px solid var(--op-pillar);
    border-radius: var(--op-radius-md);
    background: var(--op-pillar-tint);
}
/* fix/dia (R11-DIA-01): the heading in ink on its tint, the pillar colour in
   the rule beside it — the soft-tissue fuchsia on its own tint was 4.4:1, under
   the 4.5:1 every title on a tint keeps; ink is above 14:1 on all three. */
.op-frontend .op-pgroup-title { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.25; color: var(--op-text); }
.op-frontend .op-pgroup-sub { margin: 2px 0 var(--op-sp-2); font-size: 12.5px; color: var(--op-text-muted); }
.op-frontend .op-pgroup .op-problem-item:last-child { border-bottom: 0; }
/* The numbers run past 9 now: a gutter wide enough for "25." to stand clear of its label. */
.op-frontend .op-pgroup .op-problem-list { padding-inline-start: 32px; }
.op-frontend .op-pgroup .op-problem-item::before { inset-inline-start: -32px; inline-size: 24px; text-align: end; }

/* ---------- fix/plan — the Objectives card's goals (R-DOC-03, our proposal) ----------
   One row per kind of objective: its name on the start side, its chips after
   it, a hairline between rows. On a phone the name sits above its chips. */
.op-frontend .op-obj-rows { display: grid; gap: var(--op-sp-2); margin-block-end: var(--op-sp-3); }
.op-frontend .op-obj-row { padding-block-end: var(--op-sp-2); border-block-end: 1px solid var(--op-border); }
.op-frontend .op-obj-row:last-child { padding-block-end: 0; border-block-end: 0; }
.op-frontend .op-obj-row .op-field-chips {
    display: grid;
    grid-template-columns: minmax(7rem, 9rem) minmax(0, 1fr);
    align-items: start;
    gap: var(--op-sp-1) var(--op-sp-3);
    margin: 0;
}
.op-frontend .op-obj-row .op-field-chips > .op-field-label { margin: 0; padding-block-start: 6px; }
.op-frontend .op-obj-suggested { margin: 0 0 var(--op-sp-3); }
/* "More goals": face and smile, function and stability folded under one
   line, with the same ▸ / ▾ marker the other folds carry (public.css F10). */
.op-frontend .op-obj-more > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--op-sp-2);
    min-height: 36px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.op-frontend .op-obj-more > summary::-webkit-details-marker { display: none; }
.op-frontend .op-obj-more > summary::after { content: '▾'; font-size: 10px; color: var(--op-text-soft); }
.op-frontend .op-obj-more:not([open]) > summary::after { content: '▸'; }
[dir="rtl"] .op-frontend .op-obj-more:not([open]) > summary::after { content: '◂'; }
.op-frontend .op-obj-more-list { font-weight: 400; color: var(--op-text-muted); }
.op-frontend .op-obj-more > .op-obj-row { padding-block-start: var(--op-sp-2); }
@media (max-width: 600px) {
    .op-frontend .op-obj-row .op-field-chips { grid-template-columns: minmax(0, 1fr); }
    .op-frontend .op-obj-row .op-field-chips > .op-field-label { padding-block-start: 0; }
}
/* ---------- end fix/plan ---------- */

/* ---------- fix/dia — Diagnosis as dictated on 11 Nov 2026 (R11-DIA-01…10) ----------
   The look with New look off. The calm look's half is in op-zz-design.css
   (its fix/dia block): the pillar tints, the rule along each card and the
   highlight behind its title. */

/* R11-DIA-05: a finding about teeth. Ticked, its tile takes the row and the
   quadrant picker opens under the tick; unticked it is a tile like the rest. */
.op-frontend .op-dx-tile:is(.has-teeth, .has-typed).is-checked { grid-column: 1 / -1; }
.op-frontend .op-dx-tile-teeth { padding-block: 2px 4px; padding-inline-start: 28px; }   /* fix/ceph24 (M24-13): tight under its tick */
/* fix/ceph24 (M24-13): «هتلاقي الدنيا عائمة خالص» — the findings' ticks close
   together under an open picker, not spread across the card. */
.op-frontend .op-dx-block .op-feature-grid { gap: 2px var(--op-sp-3); grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.op-frontend .op-dx-tile-teeth[hidden] { display: none; }
.op-frontend .op-dx-tile-teeth .op-tpick-field { margin: 0; }
/* What an older case typed that the picker cannot show ("palatal", a primary
   "85", Re-treatment's old teeth): a small box under the tile, to keep,
   correct or clear with ×. What is in it is what prints. */
.op-frontend .op-dx-typed { margin: var(--op-sp-2) 0 0; max-width: 420px; }
.op-frontend .op-dx-typed[hidden] { display: none; }
.op-frontend .op-dx-typed > .op-field-label { margin-bottom: 4px; font-size: 12.5px; color: var(--op-text-muted); }
.op-frontend .op-dx-typed-row { display: flex; align-items: center; gap: var(--op-sp-2); }
.op-frontend .op-dx-typed-row > .op-input { flex: 1 1 auto; min-width: 0; }
.op-frontend .op-dx-typed-clear {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0;
    border: 1px solid var(--op-border); border-radius: var(--op-radius-sm);
    background: var(--op-surface); color: var(--op-text-muted);
    font-size: 18px; line-height: 1; cursor: pointer;
}
.op-frontend .op-dx-typed-clear:hover,
.op-frontend .op-dx-typed-clear:focus-visible { color: var(--op-danger-text); border-color: var(--op-danger); background: var(--op-danger-bg); }
@media (pointer: coarse) {
    .op-frontend .op-dx-typed-clear { width: 44px; height: 44px; }
}
@media (max-width: 640px) {
    .op-frontend .op-dx-tile-teeth { padding-inline-start: 0; }
}

/* R11-DIA-08: "How many mm" shows exactly when the readers print it
   (op-diagnosis.js); shut, nothing of it may take room. */
.op-frontend .op-dx-mm[hidden] { display: none; }

/* R11-DIA-10: each card ends with its own notes, set off from the fields above. */
.op-frontend .op-pillar-card > .op-field-grid + :is(.op-field-wide, .op-note-fold) { margin-top: var(--op-sp-4); }

/* R11-DIA-04: Soft tissue three by three, each cell one field. */
.op-frontend .op-dx-soft3 > .op-dx-cell { min-width: 0; }
.op-frontend .op-dx-soft3 > .op-dx-cell > .op-field { margin-bottom: 0; }
/* Lip length in Arabic: its number reads left to right (dir="auto"), so the
   input's own "end" is its right while the "mm" sits at the row's end, the
   left — "22" ran under "mm". The room is kept where the unit is. */
[dir="rtl"] .op-frontend .op-dx-cell .op-input-wrap.has-unit .op-input { padding-left: 40px; padding-right: 12px; }

/* R11-DIA-01: "Molar is lost". Molar and Canine are the row headings of each
   side — in ink and heavier than the Class I / II / III captions — and the
   Canine block stands apart from the Molar block. */
.op-frontend .op-dx-bs-row > .op-field-chips > .op-field-label {
    display: block;
    margin-bottom: var(--op-sp-2);
    font-size: 14px;
    font-weight: 800;
    color: var(--op-text);
}
.op-frontend .op-dx-bs-row + .op-dx-bs-row {
    margin-top: var(--op-sp-4);
    padding-top: var(--op-sp-3);
    border-top: 1px solid var(--op-border);
}
/* ---------- end fix/dia ---------- */
