/* OrthoPlan Pro — the patient's documents (11 Nov 2026, package fix/files).
 *
 *   the Files step and its list           R11-SUM-01, R11-SUM-02
 *   '+ Add a consent' and its page         R11-JUS-08
 *   the instructions at the visit          R11-FUP-01
 *   each step's own Export                 R11-SUM-03
 *   Patient files, beside Money            R11-DSH-02
 *
 * Layout and meaning only; the look comes from the shared containers (.op-card,
 * .op-btn, .op-chip, .op-pay-card) and the design layer that loads after this
 * file. Logical properties throughout: every screen is also drawn right to left.
 */

/* ---- The Files step ---- */
.op-frontend .op-files-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--op-sp-2); margin: 0 0 var(--op-sp-3); }
.op-frontend .op-files-add-doc { cursor: pointer; }
.op-frontend .op-files-todo { margin: 0 0 var(--op-sp-3); color: var(--op-warning-text); font-size: 13px; }
.op-frontend .op-files-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--op-sp-3); }
.op-frontend .op-files-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }

.op-frontend .op-files-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--op-border); }
.op-frontend .op-file-row {
    display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: start;
    gap: var(--op-sp-2) var(--op-sp-3); padding: var(--op-sp-3) 0; border-bottom: 1px solid var(--op-border);
}
.op-frontend .op-file-row[hidden] { display: none; }
.op-frontend .op-file-row.is-todo { border-inline-start: 3px solid var(--op-warning); padding-inline-start: var(--op-sp-2); }
.op-frontend .op-file-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: var(--op-text-muted); }
.op-frontend .op-file-main { min-width: 0; }
.op-frontend .op-file-title { margin: 0; font-weight: 600; color: var(--op-text); overflow-wrap: anywhere; }
.op-frontend .op-file-kind { font-weight: 600; color: var(--op-text-soft); }
.op-frontend .op-file-meta { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 2px 0; font-size: 13px; color: var(--op-text-muted); }
.op-frontend .op-file-meta > * + *::before,
.op-frontend .op-pf-who > * + *::before,
.op-frontend .op-pf-row-sub > * + *::before { content: "·"; margin: 0 6px; color: var(--op-text-soft); }
.op-frontend .op-file-status { margin: 4px 0 0; font-size: 13px; font-weight: 600; }
.op-frontend .op-file-status.is-todo { color: var(--op-warning-text); }
.op-frontend .op-file-status.is-done { color: var(--op-success-text); }
.op-frontend .op-file-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 320px; }
.op-frontend .op-files-upload { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.op-frontend .op-files-upload.is-busy { opacity: .6; pointer-events: none; }
/* fix/files (review): taking a wrong upload off — quiet until it is pressed, red when it is about to. */
.op-frontend .op-file-remove { display: inline-flex; align-items: center; gap: 6px; color: var(--op-danger-text, var(--op-danger)); }
.op-frontend .op-file-remove:hover, .op-frontend .op-file-remove:focus-visible { border-color: var(--op-danger); }
.op-frontend .op-file-remove.is-busy { opacity: .6; pointer-events: none; }
.op-frontend .op-files-empty { margin: var(--op-sp-3) 0 0; }
@media (max-width: 760px) {
    /* A phone: the actions under the words, the whole width, never beside them. */
    .op-frontend .op-file-row { grid-template-columns: 28px minmax(0, 1fr); }
    .op-frontend .op-file-acts { grid-column: 1 / -1; justify-content: flex-start; max-width: none; }
    .op-frontend .op-file-acts > * { flex: 1 1 auto; justify-content: center; }
}

/*
 * ---- fix/files18 (C17-SUM-02): one entry per instruction sheet ----
 * Each time it was handed is a quiet line under it, newest first: the date
 * and time, then where from, printed or sent, by whom — the same dots as the
 * meta line, a little indented so they read as the entry's own.
 */
.op-frontend .op-file-prints { list-style: none; margin: 6px 0 0; padding: 0; padding-inline-start: 10px; border-inline-start: 2px solid var(--op-border); display: grid; gap: 2px; }
.op-frontend .op-file-print-line { display: flex; flex-wrap: wrap; gap: 2px 0; font-size: 13px; color: var(--op-text-muted); }
.op-frontend .op-file-print-line > time { color: var(--op-text); font-variant-numeric: tabular-nums; }
/* The dot ends a part rather than starting the next, so a line that wraps starts with words, never with "·". */
.op-frontend .op-file-print-line > *:not(:last-child)::after { content: "·"; margin: 0 6px; color: var(--op-text-soft); }
/* On a phone the date and time is the line's own first row; where from, printed or sent and by whom follow under it. */
@media (max-width: 480px) {
    .op-frontend .op-file-print-line > time { flex-basis: 100%; }
    .op-frontend .op-file-print-line > time:not(:last-child)::after { content: none; }
    .op-frontend .op-file-print-line + .op-file-print-line { margin-top: 4px; }
}
.op-frontend .op-file-send { display: inline-flex; align-items: center; gap: 6px; }
/* fix/files18 (C17-SUM-04): "Print the sheet" — a card of Clinical Steps' linked grid, beside the appliance it names. */
/* No negative margin to line the button's text up with the label: in Arabic it pushed the link 8 px past the screen's edge (Clinical Steps at 768). A long name wraps inside its column. */
.op-frontend .op-stc-sheets { min-width: 0; }
.op-frontend .op-stc-sheet-links { display: flex; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.op-frontend .op-stc-sheet { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; white-space: normal; text-align: start; }
/* On a phone the grid's two narrow columns broke "Print the sheet: Facemask" over four lines: the card takes the grid's whole row there. */
@media (max-width: 640px) {
    .op-frontend .op-linked-grid > .op-stc-sheets { grid-column: 1 / -1; }
}

/* ---- '+ Add a consent': the page he writes (R11-JUS-08) ---- */
.op-frontend .op-consent-editor[hidden] { display: none; }
.op-frontend .op-consent-paper {
    border: 1px solid var(--op-border); border-radius: var(--op-radius-md); background: var(--op-surface);
    padding: var(--op-sp-4); margin: 0 0 var(--op-sp-3); display: grid; gap: var(--op-sp-3);
}
.op-frontend .op-consent-paper-head { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.op-frontend .op-consent-paper-head th { width: 18%; text-align: start; font-weight: 600; color: var(--op-text-muted); padding: 3px 8px 3px 0; vertical-align: top; }
.op-frontend .op-consent-paper-head td { padding: 3px 12px 3px 0; color: var(--op-text); overflow-wrap: anywhere; }
.op-frontend .op-consent-paper-head tr + tr { border-top: 1px dashed var(--op-border); }
.op-frontend .op-consent-tpl { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--op-sp-2); }
.op-frontend .op-consent-tpl .op-field { flex: 1 1 260px; min-width: 0; }
.op-frontend .op-consent-paper .op-field-wide { display: grid; gap: 4px; }
.op-frontend .op-consent-paper .op-input { width: 100%; box-sizing: border-box; }
.op-frontend .op-consent-paper-sign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--op-sp-4); margin: var(--op-sp-2) 0 0; }
.op-frontend .op-consent-paper-sign span { border-top: 1px solid var(--op-text-soft); padding-top: 4px; font-size: 12px; color: var(--op-text-muted); }
.op-frontend .op-consent-keep { margin: 0 0 var(--op-sp-3); }
@media (max-width: 760px) {
    /* The header's pairs one under the other on a phone. */
    .op-frontend .op-consent-paper { padding: var(--op-sp-3); }
    .op-frontend .op-consent-paper-head, .op-frontend .op-consent-paper-head tbody,
    .op-frontend .op-consent-paper-head tr { display: block; }
    .op-frontend .op-consent-paper-head tr { display: grid; grid-template-columns: 34% minmax(0, 1fr); }
    .op-frontend .op-consent-paper-head th, .op-frontend .op-consent-paper-head td { width: auto; }
    .op-frontend .op-consent-paper-head th:empty, .op-frontend .op-consent-paper-head td:empty { display: none; }
}

/* ---- Under the Informed consent card: the added consents and the link ---- */
.op-frontend .op-added-consents { margin: var(--op-sp-4) 0 0; padding-top: var(--op-sp-3); border-top: 1px solid var(--op-border); }
.op-frontend .op-added-consents-list { list-style: none; margin: 6px 0 var(--op-sp-2); padding: 0; display: grid; gap: 6px; }
.op-frontend .op-added-consent { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--op-sp-3); }
.op-frontend .op-added-consent-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.op-frontend .op-added-consent-acts { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.op-frontend .op-add-consent-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--op-sp-3); margin: 0; }
.op-frontend .op-add-consent-link { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; }

/* ---- The instructions at the visit (R11-FUP-01) ---- */
/* A row of its own under the tick, wherever the ticks are laid out (a list, a flex row, a grid). */
.op-frontend .op-instr-prompt { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; grid-column: 1 / -1; margin: 6px 0 var(--op-sp-2); padding-inline-start: var(--op-sp-4); }
.op-frontend .op-pending-item .op-instr-prompt { padding-inline-start: 0; }
.op-frontend .op-instr-prompt .op-btn { white-space: normal; text-align: start; }
.op-frontend .op-visit-instr, .op-frontend .op-visit-instr-write, .op-frontend .op-visit-instr-send { display: inline-flex; align-items: center; gap: 4px; }
.op-frontend .op-session-line .op-visit-instr { margin-inline-start: auto; }
/* The card's row of buttons wraps once "Download instructions" is on it, so a phone keeps it on the screen. */
.op-frontend .op-visit-meta:has(.op-visit-instr, .op-visit-instr-write) { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }

/* ---- Each step's own Export (R11-SUM-03) ---- */
.op-frontend .op-step-export { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--op-sp-3); margin: var(--op-sp-4) 0 0; }
.op-frontend .op-step-export-btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* ---- Summary: the way to Files ---- */
.op-frontend .op-summary-files-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--op-sp-2); margin: 0; }

/* ---- Patient files (R11-DSH-02) ---- */
.op-frontend .op-pf-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--op-sp-2); }
.op-frontend .op-pf-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px var(--op-sp-3);
    padding: var(--op-sp-3) var(--op-sp-4); min-height: 56px; box-sizing: border-box;
    background: var(--op-surface); border: 1px solid var(--op-border); border-radius: var(--op-radius-md);
    text-decoration: none; color: var(--op-text);
}
.op-frontend .op-pf-row:hover, .op-frontend .op-pf-row:focus-visible { border-color: var(--op-primary); }
.op-frontend .op-pf-row-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--op-sp-2); min-width: 0; }
.op-frontend .op-pf-row-name { font-weight: 600; overflow-wrap: anywhere; }
.op-frontend .op-pf-code { font-size: 12.5px; color: var(--op-text-muted); background: none; padding: 0; }
.op-frontend .op-pf-row-sub { grid-column: 1; display: flex; flex-wrap: wrap; font-size: 13px; min-width: 0; }
.op-frontend .op-pf-row-go { grid-column: 2; grid-row: 1 / span 2; color: var(--op-text-muted); }
/* fix/files (review): how many in all, and the pages — the list never stops silently. */
.op-frontend .op-pf-count { margin: 0 0 var(--op-sp-2); font-size: 13px; }
.op-frontend .op-pf-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--op-sp-2) var(--op-sp-3); margin: var(--op-sp-3) 0 0; }
.op-frontend .op-pf-pager .op-btn { display: inline-flex; align-items: center; gap: 4px; }
.op-frontend .op-pf-head .op-back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; text-decoration: none; }
.op-frontend .op-pf-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--op-sp-3); }
.op-frontend .op-pf-who { display: flex; flex-wrap: wrap; align-items: center; margin: 4px 0 0; }
.op-frontend .op-pf-phone { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; font-weight: 600; text-decoration: none; }
/* Money and the photos on the left, the visits beside both, the files under all three. */
.op-frontend .op-pf-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--op-sp-4); align-items: start;
    grid-template-areas: "money visits" "photos visits" "docs docs";
}
.op-frontend .op-pf-grid > .op-card { margin: 0; min-width: 0; }
.op-frontend .op-pf-money { grid-area: money; }
.op-frontend .op-pf-visits { grid-area: visits; }
.op-frontend .op-pf-photos { grid-area: photos; }
.op-frontend .op-pf-docs { grid-area: docs; }
.op-frontend .op-pf-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px var(--op-sp-3); margin: 0 0 var(--op-sp-3); }
.op-frontend .op-pf-sec-head .op-fsec-title { margin: 0; }
.op-frontend .op-pf-more { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; min-height: 32px; }
.op-frontend .op-pf-pay { margin: 0; }
.op-frontend .op-pf-visit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 260px; overflow-y: auto; }
.op-frontend .op-pf-visit-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--op-sp-3); font-size: 13.5px; padding: 4px 0; border-bottom: 1px dashed var(--op-border); }
.op-frontend .op-pf-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.op-frontend .op-pf-photo { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--op-radius-sm); background: var(--op-bg-alt); }
.op-frontend .op-pf-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 900px) {
    .op-frontend .op-pf-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "money" "visits" "photos" "docs"; }
}

/* ---- Touch: chair-side sizes ---- */
@media (pointer: coarse) {
    /* Doubled root class: above the design layer's text-link rule (min-height 0), which loads after this file. */
    .op-frontend.op-frontend :is(.op-add-consent-link, .op-pf-more, .op-pf-phone, .op-pf-head .op-back-link, .op-files-chip) { min-height: 44px; }
}

/* ---- fix/doctor (12 Nov 2026): the sheets' card at the foot of Follow-up ----
   Where the words come from, beside the item; the Hyrax key's three
   pictures; the items of the case with no sheet yet, one tap each. */
.op-frontend .op-instr-src {
    display: inline-block; margin-inline-start: 6px; padding: 1px 8px;
    border-radius: var(--op-radius-pill, 999px); background: var(--op-bg-alt, #f1f4f6);
    font-size: 12px; font-weight: 600; color: var(--op-text-muted, #5b6b74); vertical-align: middle;
}
.op-frontend .op-instr-src.is-proposal { background: var(--op-warning-light, #fff4e0); color: var(--op-warning-text, #8a5a00); }
.op-frontend .op-instr-src[hidden] { display: none; }
.op-frontend .op-instr-row[hidden] { display: none; }
.op-frontend .op-instr-elhint { margin: 6px 0 0; }
.op-frontend .op-instr-pics { margin-top: var(--op-sp-3); }
.op-frontend .op-instr-pics .op-field-label { margin-bottom: 2px; }
.op-frontend .op-instr-pics-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--op-sp-2); margin-top: var(--op-sp-2); }
.op-frontend .op-instr-pic {
    margin: 0; padding: var(--op-sp-2); border: 1px solid var(--op-border); border-radius: var(--op-radius-md, 10px);
    background: var(--op-surface); display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.op-frontend .op-instr-pic.is-his { border-color: var(--op-primary); }
.op-frontend .op-instr-pic-art svg,
.op-frontend .op-instr-pic-art img { display: block; width: 100%; height: auto; max-height: 160px; object-fit: contain; }
.op-frontend .op-instr-pic figcaption { font-size: 13px; line-height: 1.45; }
.op-frontend .op-instr-pic-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.op-frontend .op-instr-pic-pick { position: relative; overflow: hidden; cursor: pointer; }
.op-frontend .op-instr-pic-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.op-frontend .op-instr-pic-acts [hidden] { display: none; }
.op-frontend .op-instr-more { margin-top: var(--op-sp-3); padding-top: var(--op-sp-3); border-top: 1px solid var(--op-border); }
.op-frontend .op-instr-more-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 var(--op-sp-2); }
.op-frontend .op-instr-prompt-board { margin: var(--op-sp-2) 0; padding-inline-start: 0; }
@media (max-width: 640px) {
    .op-frontend .op-instr-pics-grid { grid-template-columns: minmax(0, 1fr); }
    .op-frontend .op-instr-pic-art svg, .op-frontend .op-instr-pic-art img { max-height: 200px; }
}
@media (pointer: coarse) {
    .op-frontend .op-instr-pic-acts .op-btn,
    .op-frontend .op-instr-more-chip { min-height: 44px; }
    /* fix/doctor (review): '+ Add an item with a sheet' is a 44 px row of its
       own — the calm layer's 13 px over and under a text link left it 39. */
    .op-frontend .op-instr-more .op-addopt > .op-addopt-open { min-height: 44px; padding-block: 0; margin-block: 0; }
}

/*
 * ---- fix/files18 (C17-I18N-02): Settings › Language · اللغة ----
 * Two buttons, each named in itself, the one in use pressed; a finger's
 * width each on a tablet, side by side even on a phone.
 */
.op-frontend .op-lang-form { margin: 0; }
.op-frontend .op-lang-choices { display: flex; flex-wrap: wrap; gap: var(--op-sp-2); }
.op-frontend .op-lang-choice { min-height: 44px; min-width: 120px; justify-content: center; }
.op-frontend .op-lang-saved { display: flex; align-items: center; gap: 6px; margin: var(--op-sp-2) 0 0; color: var(--op-success-text); }
