/* === Glasses prescription reader (tool id "rx") ===
   Sits inside <section class="panel dark tool-panel">. The form looks like the paper it copies:
   a white "prescription" card with one row per eye. Reuses .pill and .fchip; everything new is
   prefixed tl-rx-. Colours come from the theme variables. Reading text is 16px or more. */

.tl-rx { width: 100%; min-width: 0; color: #fff; font-size: clamp(16px, 1.05vw, 20px); line-height: 1.5; }
.tl-rx *, .tl-rx *::before, .tl-rx *::after { box-sizing: border-box; }
.tl-rx [hidden] { display: none !important; }
.tl-rx :focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.tl-rx .pill:focus-visible, .tl-rx .fchip:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.tl-rx-screen { display: flex; flex-direction: column; gap: clamp(16px, 1.6vw, 30px); }
.tl-rx-screen.is-enter { animation: tl-rx-in 0.45s var(--ease) both; }
@keyframes tl-rx-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.tl-rx-form { display: flex; flex-direction: column; gap: clamp(16px, 1.6vw, 30px); margin: 0; }

/* Intro and paste box */
.tl-rx-top { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(16px, 2.4vw, 48px); align-items: center; }
.tl-rx-intro { color: #fff; font-size: clamp(20px, 1.6vw, 32px); font-weight: 500; line-height: 1.3; letter-spacing: -0.01em; text-wrap: balance; }
.tl-rx-paste { display: flex; flex-direction: column; gap: 10px; padding: clamp(18px, 1.8vw, 32px); border: 1px solid rgb(255 255 255 / 0.16); border-radius: var(--r); background: rgb(255 255 255 / 0.05); }
.tl-rx-paste label { color: rgb(255 255 255 / 0.88); font-size: clamp(16px, 1vw, 19px); }
.tl-rx-paste code { padding: 2px 8px; border-radius: 8px; background: rgb(255 255 255 / 0.14); color: #fff; font-family: inherit; font-weight: 500; white-space: nowrap; }
.tl-rx-paste-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.tl-rx .fchip { height: clamp(46px, 3.2vw, 58px); padding: 0 18px; font-size: 16px; white-space: nowrap; }
.tl-rx-paste-m { min-height: 0; color: rgb(255 255 255 / 0.85); font-size: 16px; }
.tl-rx-paste-m:empty { display: none; }
.tl-rx-paste-m.is-ok::before { content: "\2713  "; color: var(--soft); font-weight: 700; }
.tl-rx-paste-m.is-warn::before { content: "!  "; color: var(--pale); font-weight: 700; }

/* The white "prescription paper" */
.tl-rx-paper { display: flex; flex-direction: column; gap: 0; padding: clamp(8px, 1vw, 20px) clamp(20px, 2.4vw, 48px) clamp(20px, 2vw, 40px); border-radius: var(--r); background: #fff; color: var(--navy); }
.tl-rx-eye { display: grid; grid-template-columns: minmax(150px, 0.22fr) minmax(0, 1fr); gap: 20px; align-items: start; padding: clamp(16px, 1.5vw, 28px) 0; border-bottom: 1px solid rgb(var(--navy-rgb) / 0.1); }
.tl-rx-eye-h { display: flex; align-items: center; gap: 12px; padding-top: 30px; color: var(--navy); font-size: clamp(18px, 1.25vw, 24px); font-weight: 500; line-height: 1.2; }
.tl-rx-eye-badge { display: inline-grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 16px; font-weight: 500; }
.tl-rx-eye-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tl-rx-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tl-rx-field label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; color: var(--navy); font-size: 16px; line-height: 1.25; }
.tl-rx-field label b { font-weight: 700; letter-spacing: 0.02em; }
.tl-rx-field label span { color: var(--gray-500); font-size: 15px; }
.tl-rx-inwrap { position: relative; }
.tl-rx-input { width: 100%; min-width: 0; height: clamp(52px, 3.5vw, 66px); padding: 0 14px; border: 1px solid rgb(var(--navy-rgb) / 0.28); border-radius: 14px; background: var(--mist); color: var(--navy); font-size: clamp(18px, 1.2vw, 23px); font-weight: 500; font-variant-numeric: tabular-nums; transition: border-color 0.25s, box-shadow 0.25s, background-color 0.25s; }
.tl-rx-input::placeholder { color: rgb(var(--navy-rgb) / 0.32); font-weight: 400; }
.tl-rx-input:hover { border-color: rgb(var(--navy-rgb) / 0.5); }
.tl-rx-input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgb(var(--blue-rgb) / 0.2); outline: none; }
.tl-rx-paste .tl-rx-input { border-color: transparent; background: #fff; }
.tl-rx-paste .tl-rx-input:focus { box-shadow: 0 0 0 3px var(--soft); }
.tl-rx-paper :focus-visible { outline-color: var(--blue); }
.tl-rx-input[aria-invalid="true"] { border-color: var(--navy); border-width: 2px; background: #fff; }
/* the sign button and number read left to right on every page (see the end of this file) */
/*rtl:ignore*/
.has-sign .tl-rx-input { padding-left: 50px; }
/*rtl:ignore*/
.tl-rx-sign { position: absolute; left: 6px; top: 50%; display: grid; place-items: center; width: 38px; height: 38px; margin-top: -19px; border: 0; border-radius: 10px; background: var(--tint); color: var(--blue-dk); font-size: 20px; font-weight: 500; line-height: 1; transition: background-color 0.2s, color 0.2s; }
.tl-rx-sign:hover { background: var(--blue); color: #fff; }
.tl-rx-sign:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.tl-rx-fhint { color: var(--gray-500); font-size: 15px; line-height: 1.35; }
.tl-rx-fmsg { position: relative; padding-left: 26px; color: var(--navy); font-size: 15px; line-height: 1.35; }
.tl-rx-fmsg::before { content: "!"; position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; }
.tl-rx-fmsg.is-warn::before { background: var(--pale); color: var(--navy); }

.tl-rx-same-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 14px 0; border-bottom: 1px solid rgb(var(--navy-rgb) / 0.1); }
.tl-rx-same { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid rgb(var(--blue-rgb) / 0.4); border-radius: 999px; background: var(--tint); color: var(--blue-dk); font-size: 16px; font-weight: 500; transition: background-color 0.25s, color 0.25s; }
.tl-rx-same:hover { background: var(--blue); color: #fff; }
.tl-rx-same:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.tl-rx-same-m { color: var(--gray-700); font-size: 16px; }
.tl-rx-same-m:empty { display: none; }

.tl-rx-extras { min-width: 0; margin: 0; padding: clamp(16px, 1.5vw, 28px) 0 0; border: 0; }
.tl-rx-extras legend { float: left; width: 100%; margin-bottom: 12px; padding: 0; color: var(--gray-500); font-size: 15px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.tl-rx-extras-fields { clear: both; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

/* Errors, actions, disclaimer */
.tl-rx-err { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; border-radius: 16px; background: #fff; color: var(--navy); font-weight: 500; }
.tl-rx-err-i { display: grid; flex: none; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 15px; font-weight: 700; }
.tl-rx-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.tl-rx-disc { max-width: 62em; color: rgb(255 255 255 / 0.8); font-size: 16px; line-height: 1.55; }

/* Result screen */
.tl-rx-result-h { align-self: flex-start; max-width: 100%; color: #fff; font-size: clamp(26px, 2.2vw, 44px); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; }
.tl-rx-result-h:focus { outline: none; }
.tl-rx-result-h:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 4px; }
.tl-rx-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 1.4vw, 28px); align-items: stretch; }
.tl-rx-cards.is-single { grid-template-columns: minmax(0, 1fr); }
.tl-rx-card { display: flex; flex-direction: column; gap: clamp(14px, 1.2vw, 22px); min-width: 0; padding: clamp(20px, 2.2vw, 44px); border-radius: var(--r); background: #fff; color: var(--navy); }
.tl-rx-card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.tl-rx-card-h h3 { display: flex; align-items: center; gap: 12px; font-size: clamp(19px, 1.35vw, 26px); font-weight: 500; }
.tl-rx-tag { padding: 6px 14px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 15px; font-weight: 500; }
.tl-rx-notation { display: grid; gap: 12px; margin: 0; }
.tl-rx-notation div { min-width: 0; }
.tl-rx-notation dt, .tl-rx-stats dt { color: var(--gray-500); font-size: 15px; font-weight: 500; }
.tl-rx-notation dt small { font-size: 1em; font-weight: 400; }
.tl-rx-notation dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.tl-rx-written dd { color: var(--blue-dk); font-size: clamp(30px, 2.8vw, 56px); font-weight: 500; line-height: 1.05; letter-spacing: -0.02em; }
.tl-rx-other dd { color: var(--navy); font-size: clamp(20px, 1.5vw, 30px); font-weight: 500; }
.tl-rx-muted { color: var(--gray-700); font-size: 16px; font-weight: 400; }
.tl-rx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0; }
.tl-rx-stats div { padding: 12px 16px; border-radius: 14px; background: var(--tint); }
.tl-rx-stats dd { margin: 2px 0 0; color: var(--navy); font-size: clamp(22px, 1.6vw, 32px); font-weight: 500; font-variant-numeric: tabular-nums; }
.tl-rx-msgs { display: grid; gap: 0; }
.tl-rx-msgs li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 12px 0; border-top: 1px solid rgb(var(--navy-rgb) / 0.1); }
.tl-rx-msg-l { color: var(--blue-dk); font-size: 15px; font-weight: 700; letter-spacing: 0.03em; }
.tl-rx-msgs p { color: var(--gray-700); font-size: clamp(16px, 1vw, 19px); line-height: 1.5; }
.tl-rx-msgs li.is-warn .tl-rx-msg-l, .tl-rx-msgs li.is-note .tl-rx-msg-l { color: var(--navy); }
.tl-rx-msgs li.is-warn p, .tl-rx-msgs li.is-note p { color: var(--navy); font-weight: 500; }

.tl-rx-pair { padding: clamp(20px, 2.2vw, 44px); border: 1px solid rgb(255 255 255 / 0.16); border-radius: var(--r); background: rgb(255 255 255 / 0.05); }
.tl-rx-pair h3 { margin-bottom: 6px; color: #fff; font-size: clamp(19px, 1.35vw, 26px); font-weight: 500; }
.tl-rx-pair .tl-rx-msgs { display: block; columns: 2; column-gap: clamp(24px, 3vw, 56px); }
.tl-rx-pair .tl-rx-msgs.is-one { columns: 1; }
.tl-rx-pair .tl-rx-msgs li { break-inside: avoid; border-top-color: rgb(255 255 255 / 0.14); }
.tl-rx-pair .tl-rx-msg-l { color: var(--pale); }
.tl-rx-pair .tl-rx-msgs p { color: rgb(255 255 255 / 0.88); }
.tl-rx-pair .tl-rx-msgs b { display: block; margin-bottom: 2px; color: #fff; font-size: clamp(24px, 1.7vw, 34px); font-weight: 500; line-height: 1.2; }

.tl-rx-surg { display: flex; flex-direction: column; gap: 14px; padding: clamp(20px, 2.2vw, 44px); border-radius: var(--r); background: linear-gradient(160deg, var(--blue-dk) 0%, var(--deep) 100%); }
.tl-rx-surg h3 { color: #fff; font-size: clamp(20px, 1.5vw, 30px); font-weight: 500; line-height: 1.25; }
.tl-rx-surg-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.tl-rx-surg.has-icl .tl-rx-surg-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tl-rx-range { display: flex; flex-direction: column; gap: 10px; padding: clamp(16px, 1.4vw, 26px); border-radius: calc(var(--r) * 0.7); background: rgb(255 255 255 / 0.1); }
.tl-rx-range > p { color: #fff; font-weight: 500; }
.tl-rx-range ul { display: grid; gap: 8px; }
.tl-rx-range li { display: flex; align-items: flex-start; gap: 10px; color: rgb(255 255 255 / 0.92); }
.tl-rx-range li svg { flex: none; width: 28px; height: 28px; padding: 5px; border-radius: 50%; background: #fff; color: var(--blue-dk); }
.tl-rx-range li.is-out svg { background: var(--pale); color: var(--navy); }
.tl-rx-range li b { color: #fff; font-weight: 500; }
.tl-rx-surg-always { color: rgb(255 255 255 / 0.9); }

/* Urgent message: always under the form */
.tl-rx-urgent { display: flex; align-items: flex-start; gap: 14px; margin-top: clamp(16px, 1.6vw, 30px); padding: clamp(16px, 1.6vw, 28px) clamp(18px, 2vw, 36px); border: 1px solid rgb(255 255 255 / 0.22); border-radius: var(--r); background: rgb(255 255 255 / 0.04); }
.tl-rx-urgent-i { display: grid; flex: none; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--pale); color: var(--navy); }
.tl-rx-urgent p { color: rgb(255 255 255 / 0.9); font-size: 16px; line-height: 1.55; }

/* Tablet */
@media (max-width: 991.98px) {
  .tl-rx-top { grid-template-columns: minmax(0, 1fr); }
  .tl-rx-eye { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tl-rx-eye-h { padding-top: 0; }
  .tl-rx-surg.has-icl .tl-rx-surg-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .tl-rx-cards { grid-template-columns: minmax(0, 1fr); }
  .tl-rx-pair .tl-rx-msgs { columns: 1; }
}
/* Phone */
@media (max-width: 640px) {
  .tl-rx-paste { padding: 16px; border-radius: 22px; }
  .tl-rx-paste-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tl-rx-paste-in { grid-column: 1 / -1; }
  .tl-rx .fchip { justify-content: center; padding: 0 10px; white-space: normal; text-align: center; line-height: 1.2; }
  .tl-rx-paper { padding: 4px 16px 18px; border-radius: 22px; }
  .tl-rx-eye-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tl-rx-extras-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tl-rx-extras-fields .tl-rx-f-prism { grid-column: 1 / -1; }
  .tl-rx-input { padding: 0 12px; }
  /*rtl:ignore*/
  .has-sign .tl-rx-input { padding-left: 46px; }
  /*rtl:ignore*/
  .tl-rx-sign { left: 5px; width: 36px; height: 36px; margin-top: -18px; }
  .tl-rx-card, .tl-rx-pair, .tl-rx-surg { padding: 20px 18px; border-radius: 22px; }
  .tl-rx-range { border-radius: 16px; }
  .tl-rx-urgent { padding: 16px; border-radius: 22px; }
  .tl-rx-urgent-i { width: 38px; height: 38px; }
  .tl-rx-actions .pill { width: 100%; white-space: normal; text-align: center; line-height: 1.2; }
}

@media (prefers-reduced-motion: reduce) {
  .tl-rx-screen.is-enter { animation: none; }
  .tl-rx-input, .tl-rx-sign, .tl-rx-same { transition: none; }
}

@media print {
  .tl-rx, .tl-rx-result-h, .tl-rx-pair h3, .tl-rx-surg h3, .tl-rx-range > p, .tl-rx-range li, .tl-rx-range li b, .tl-rx-surg-always, .tl-rx-disc, .tl-rx-urgent p, .tl-rx-pair .tl-rx-msgs p, .tl-rx-pair .tl-rx-msgs b, .tl-rx-pair .tl-rx-msg-l { color: #000 !important; }
  .tl-rx-form-screen, .tl-rx-actions, .tl-rx-urgent-i { display: none !important; }
  .tl-rx-screen { animation: none; }
  .tl-rx-card, .tl-rx-pair, .tl-rx-surg, .tl-rx-range, .tl-rx-urgent { border: 1px solid #999; background: #fff !important; break-inside: avoid; }
  .tl-rx-cards { grid-template-columns: 1fr 1fr; }
}

/* Right-to-left pages: prescription numbers and the pasted prescription line read left to right */
/*rtl:begin:ignore*/
[dir="rtl"] .tl-rx-inwrap { direction: ltr; }
[dir="rtl"] .tl-rx-paste-row input { direction: ltr; text-align: right; }
/*rtl:end:ignore*/
