/* Dentigram — prescription print studio (setup sheet, output sheet, print queue, guide, page sizes). */

/* ── Shared sheet shell (bottom sheet on phones, card on desktop) ── */
.rps-overlay { z-index: 31000; }
.rps-overlay .modal { max-width: 520px; }
@media (max-width: 640px) {
  .rps-overlay.open { align-items: flex-end; padding: 0; }
  .rps-overlay .modal { max-width: none; max-height: 94vh; border-radius: 24px 24px 0 0; animation: rpsUp .3s cubic-bezier(.2,.9,.3,1) both; }
  @keyframes rpsUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
}
.rps-x { width: 40px; height: 40px; border: 0; border-radius: 12px; background: rgba(255,255,255,.16); color: inherit; font-size: 22px; line-height: 1; cursor: pointer; flex: 0 0 auto; }

/* ── Setup sheet ── */
.rps-sheet { background: #f4f7f8; }
.rps-hero { position: relative; padding: 16px 16px 14px; color: #fff; background:
  radial-gradient(120% 90% at 100% 0%, #1b8aa8 0%, transparent 60%),
  linear-gradient(160deg, #0b4a62 0%, #0d5c7a 55%, #0a3e52 100%); }
.rps-hero .rps-x { position: absolute; inset-inline-end: 12px; top: 12px; }
.rps-kicker { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .02em; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); padding: 3px 10px; border-radius: 999px; }
.rps-hero h3 { margin: 8px 0 12px; font-size: 20px; font-weight: 900; color: #fff; }
.rps-preview { position: relative; display: grid; place-items: center; width: 100%; max-height: 210px; overflow: hidden; padding: 12px; border: 0; border-radius: 16px; background: rgba(255,255,255,.08); cursor: zoom-in; transition: max-height .35s ease; }
.rps-preview::after { content: ''; position: absolute; inset: auto 0 0; height: 46px; background: linear-gradient(transparent, rgba(11,74,98,.92)); pointer-events: none; transition: opacity .3s; }
.rps-preview.big { max-height: 1200px; cursor: zoom-out; }
.rps-preview.big::after { opacity: 0; }
.rps-paper { position: relative; overflow: hidden; background: #fff; border-radius: 4px; box-shadow: 0 18px 40px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.2); }
#rps-preview { transform-origin: top right; }
[dir="ltr"] #rps-preview, html[lang="en"] #rps-preview { transform-origin: top left; }
#rps-preview .rx-print { box-shadow: none !important; }
.rps-paper-tag { position: absolute; z-index: 2; bottom: 10px; inset-inline-start: 12px; font: 800 11px/1 system-ui, sans-serif; color: #0b4a62; background: #fff; padding: 5px 9px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }

.rps-body { padding: 12px 12px 4px; display: grid; gap: 10px; overflow-y: auto; }
.rps-card { background: #fff; border: 1px solid #e3eaee; border-radius: 16px; padding: 12px; display: grid; gap: 9px; }
.rps-h { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 900; color: #12333f; }
.rps-h b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: #e6f3f7; color: #0d5c7a; font-size: 12px; }
.rps-in { width: 100%; min-height: 44px; padding: 10px 12px; border: 1.5px solid #dbe5ea; border-radius: 12px; background: #fbfdfe; font: inherit; font-size: 14px; color: #12333f; transition: border-color .15s, box-shadow .15s; }
.rps-in:focus { outline: none; border-color: #1b8aa8; box-shadow: 0 0 0 3px rgba(27,138,168,.15); background: #fff; }
.rps-id { display: grid; grid-template-columns: 78px 1fr; gap: 9px; align-items: center; }
.rps-id-fields { display: grid; gap: 7px; }
.rps-logo { position: relative; display: grid; place-items: center; width: 78px; height: 96px; border: 1.5px dashed #b8ccd5; border-radius: 16px; background: #f6fafb; cursor: pointer; overflow: hidden; }
.rps-logo img { width: 62px; height: 62px; object-fit: contain; }
.rps-logo > span { font-size: 26px; color: #9fb3bc; }
.rps-logo i { position: absolute; bottom: 6px; inset-inline-end: 6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #0d5c7a; color: #fff; font-style: normal; font-size: 14px; font-weight: 900; }
.rps-logo-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rps-chip { min-height: 36px; padding: 6px 12px; border: 1.5px solid #dbe5ea; border-radius: 999px; background: #fff; font: inherit; font-size: 12.5px; font-weight: 700; color: #345b68; cursor: pointer; }
.rps-chip.on { border-color: #0d5c7a; background: #e6f3f7; color: #0b4a62; }

.rps-frames { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.rps-frame { display: grid; gap: 5px; justify-items: center; padding: 7px 4px 6px; border: 1.5px solid #e3eaee; border-radius: 14px; background: #fff; cursor: pointer; font: inherit; }
.rps-frame em { font-style: normal; font-size: 11.5px; font-weight: 800; color: #345b68; }
.rps-frame.on { border-color: #0d5c7a; box-shadow: 0 0 0 3px rgba(13,92,122,.14); }
.rps-thumb { --rxc: #0d5c7a; position: relative; display: grid; align-content: start; gap: 4px; width: 46px; height: 62px; padding: 7px 6px; background: #fff; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.14); }
.rps-thumb i { display: block; height: 4px; border-radius: 2px; background: #dfe7eb; }
.rps-thumb i:first-child { height: 6px; width: 70%; justify-self: center; background: var(--rxc); }
.rps-thumb i:nth-child(3) { width: 60%; }
.rps-thumb-classic { outline: 2.5px double var(--rxc); outline-offset: -4px; }
.rps-thumb-elegant { box-shadow: 0 1px 4px rgba(0,0,0,.14), inset 0 0 0 1.5px var(--rxc), inset 0 0 0 3px #fff, inset 0 0 0 4px var(--rxc); border-radius: 6px; }
.rps-thumb-modern { border-top: 6px solid var(--rxc); border-bottom: 2px solid var(--rxc); }
.rps-tones { display: flex; gap: 9px; flex-wrap: wrap; padding: 2px 0; }
.rps-tone { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--c); cursor: pointer; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px transparent, 0 2px 6px rgba(0,0,0,.18); transition: transform .12s; }
.rps-tone.on { transform: scale(1.12); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c), 0 2px 6px rgba(0,0,0,.18); }
.rps-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #eef3f5; border-radius: 14px; }
.rps-seg button { min-height: 44px; border: 0; border-radius: 11px; background: transparent; font: inherit; font-size: 13.5px; font-weight: 800; color: #4a6670; cursor: pointer; display: grid; place-items: center; line-height: 1.2; }
.rps-seg button small { font-size: 10.5px; font-weight: 600; opacity: .75; }
.rps-seg button.on { background: #fff; color: #0b4a62; box-shadow: 0 1px 4px rgba(10,40,55,.14); }
.rps-switch { display: flex; align-items: center; gap: 11px; min-height: 52px; padding: 8px 10px; border: 1.5px solid #e3eaee; border-radius: 14px; cursor: pointer; }
.rps-switch input { appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 auto; width: 46px; height: 28px; margin: 0; border-radius: 999px; background: #cfdbe0; cursor: pointer; transition: background .2s; }
.rps-switch input::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .2s; }
.rps-switch input:checked { background: #0e9f88; }
.rps-switch input:checked::after { inset-inline-start: 21px; }
.rps-switch input:disabled { opacity: .45; }
.rps-switch span { display: grid; gap: 2px; }
.rps-switch b { font-size: 13.5px; color: #12333f; }
.rps-switch small { font-size: 11.5px; color: #6b8590; }
.rps-lh { display: grid; gap: 10px; padding: 10px; border-radius: 12px; background: #f6fafb; }
.rps-lh label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 700; color: #345b68; }
.rps-lh output { font-weight: 900; color: #0b4a62; }
.rps-lh input[type=range] { -webkit-appearance: auto; appearance: auto; width: 100%; height: 32px; min-height: 32px; margin: 0; padding: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; accent-color: #0d5c7a; }
.rps-hint { font-size: 11.5px; color: #6b8590; line-height: 1.7; }
.rps-tip { margin: 0; font-size: 13px; line-height: 1.75; color: #24434e; background: #eef8f5; border: 1px solid #cfeae2; border-radius: 12px; padding: 9px 11px; }
.rps-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.rps-ghost { min-height: 46px; padding: 8px 10px; border: 1.5px solid #d6e3e8; border-radius: 13px; background: #fff; font: inherit; font-size: 13px; font-weight: 800; color: #24505e; cursor: pointer; }
.rps-ghost:active, .rps-chip:active, .rps-frame:active, .rpo-opt:active { transform: scale(.97); }
.rps-foot { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #e3eaee; }
.rps-skip { min-height: 50px; padding: 0 16px; border: 0; border-radius: 14px; background: #eef3f5; font: inherit; font-size: 13.5px; font-weight: 800; color: #4a6670; cursor: pointer; }
.rps-save { min-height: 50px; padding: 0 16px; border: 0; border-radius: 14px; background: linear-gradient(135deg, #0e9f88, #0d5c7a); color: #fff; font: inherit; font-size: 15px; font-weight: 900; cursor: pointer; box-shadow: 0 6px 16px rgba(13,92,122,.28); }
.rps-set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 7px; margin-bottom: 8px; }
#rps-settings .rps-switch { margin-top: 7px; }

/* ── Output sheet / queue / guide ── */
.rpo-sheet { background: #fff; }
.rpo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 10px; }
.rpo-head h3 { margin: 0; font-size: 18px; font-weight: 900; color: #12333f; }
.rpo-head small { color: #6b8590; font-size: 12px; }
.rpo-head .rps-x { background: #eef3f5; color: #345b68; }
.rpo-list { display: grid; gap: 8px; padding: 4px 14px 10px; }
.rpo-opt { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 10px 12px; border: 1.5px solid #e3eaee; border-radius: 16px; background: #fff; text-align: start; font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.rpo-opt span:last-child { display: grid; gap: 2px; }
.rpo-opt b { font-size: 14.5px; color: #12333f; }
.rpo-opt small { font-size: 12px; color: #6b8590; }
.rpo-ic { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 auto; border-radius: 14px; background: #eef6f9; font-size: 22px; }
.rpo-opt.last { border-color: #0e9f88; box-shadow: 0 0 0 3px rgba(14,159,136,.12); }
.rpo-opt:disabled { opacity: .5; cursor: not-allowed; }
.rpo-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 4px 14px calc(14px + env(safe-area-inset-bottom)); }
.rpo-links button { min-height: 40px; padding: 6px 12px; border: 0; border-radius: 999px; background: #f1f5f7; font: inherit; font-size: 12.5px; font-weight: 800; color: #345b68; cursor: pointer; }

.rpq-list { display: grid; gap: 8px; padding: 4px 14px calc(16px + env(safe-area-inset-bottom)); max-height: 60vh; overflow-y: auto; }
.rpq-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1.5px solid #e3eaee; border-radius: 14px; }
.rpq-item > div { display: grid; gap: 2px; min-width: 0; }
.rpq-item b { font-size: 14.5px; color: #12333f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpq-item small { font-size: 11.5px; color: #6b8590; }
.rpq-item .rps-save { min-height: 46px; padding: 0 20px; font-size: 14px; }
.rpq-empty { padding: 26px; text-align: center; font-weight: 800; color: #0e9f88; }
#rpq-badge { position: fixed; z-index: 1200; bottom: calc(env(safe-area-inset-bottom) + 168px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 6px 16px 6px 8px; border: 0; border-radius: 999px; background: linear-gradient(135deg, #0e9f88, #0d5c7a); color: #fff; font: inherit; font-size: 13px; font-weight: 800; box-shadow: 0 10px 26px rgba(13,92,122,.35); cursor: pointer; animation: rpqIn .4s cubic-bezier(.2,.9,.3,1.3) both, rpqPulse 2.4s ease-in-out .6s infinite; }
#rpq-badge b { display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: #fff; color: #0d5c7a; font-size: 13px; }
#rpq-badge em { font-style: normal; white-space: nowrap; }
@keyframes rpqIn { from { opacity: 0; transform: translate(-50%, 14px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes rpqPulse { 0%, 100% { box-shadow: 0 10px 26px rgba(13,92,122,.35), 0 0 0 0 rgba(14,159,136,.45); } 50% { box-shadow: 0 10px 26px rgba(13,92,122,.35), 0 0 0 10px rgba(14,159,136,0); } }
@media (prefers-reduced-motion: reduce) { #rpq-badge { animation: none; } .rps-preview { transition: none; } }

.rpg-body { display: grid; gap: 9px; padding: 4px 14px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; }
.rpg-rule { display: grid; gap: 6px; padding: 14px; border-radius: 16px; color: #fff; background: linear-gradient(150deg, #0b4a62, #0e9f88); }
.rpg-rule span { font-size: 11px; font-weight: 800; opacity: .85; }
.rpg-rule b { font-size: 15px; line-height: 1.6; }
.rpg-logos { display: flex; gap: 6px; flex-wrap: wrap; }
.rpg-logos i { font-style: normal; font-size: 11px; font-weight: 900; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); direction: ltr; }
.rpg-h { margin-top: 6px; font-size: 13.5px; font-weight: 900; color: #12333f; }
.rpg-card { padding: 11px 12px; border: 1.5px solid #e3eaee; border-radius: 14px; background: #fff; }
.rpg-card.rpg-best { border-color: #0e9f88; background: linear-gradient(180deg, #f1fbf8, #fff 60%); }
.rpg-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rpg-top b { font-size: 14.5px; color: #12333f; direction: ltr; }
.rpg-top span { flex: 0 0 auto; font-size: 10.5px; font-weight: 900; padding: 3px 9px; border-radius: 999px; background: #e6f3f7; color: #0b4a62; }
.rpg-best .rpg-top span { background: #0e9f88; color: #fff; }
.rpg-card ul { margin: 7px 0 0; padding-inline-start: 18px; display: grid; gap: 3px; font-size: 12.5px; color: #24434e; line-height: 1.6; }
.rpg-caution { margin-top: 7px; font-size: 11.5px; color: #8a5a10; background: #fff7e8; border-radius: 10px; padding: 6px 9px; line-height: 1.6; }
.rpg-avoid { display: grid; gap: 6px; }
.rpg-avoid > div { display: grid; gap: 2px; padding: 9px 11px; border-radius: 12px; background: #fdf2f2; border: 1px solid #f6d7d7; }
.rpg-avoid b { font-size: 13px; color: #8a1f1f; }
.rpg-avoid small { font-size: 11.5px; color: #6d3a3a; line-height: 1.6; }
.rpg-steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; font-size: 12.5px; color: #24434e; line-height: 1.7; }

/* ── Dark theme ── */
body.theme-dark .rps-sheet, body.theme-dark .rpo-sheet { background: #10181c; }
body.theme-dark .rps-card, body.theme-dark .rpo-opt, body.theme-dark .rpq-item, body.theme-dark .rpg-card, body.theme-dark .rps-frame, body.theme-dark .rps-chip, body.theme-dark .rps-ghost, body.theme-dark .rps-switch, body.theme-dark .rps-foot { background: #172228; border-color: #26363e; }
body.theme-dark .rps-in { background: #0f171b; border-color: #2a3c45; color: #eef5f6; }
body.theme-dark .rps-h, body.theme-dark .rps-switch b, body.theme-dark .rpo-head h3, body.theme-dark .rpo-opt b, body.theme-dark .rpq-item b, body.theme-dark .rpg-top b, body.theme-dark .rpg-h { color: #eef5f6; }
body.theme-dark .rps-chip, body.theme-dark .rps-ghost, body.theme-dark .rps-frame em, body.theme-dark .rpg-card ul, body.theme-dark .rpg-steps, body.theme-dark .rps-lh label { color: #bcd0d6; }
body.theme-dark .rps-seg, body.theme-dark .rps-skip, body.theme-dark .rpo-links button, body.theme-dark .rpo-head .rps-x, body.theme-dark .rps-lh, body.theme-dark .rpo-ic { background: #1d2a31; color: #bcd0d6; }
body.theme-dark .rps-seg button.on { background: #2a3c45; color: #fff; }
body.theme-dark .rps-tip { background: #12302a; border-color: #1e4a40; color: #cfeae2; }
body.theme-dark .rpg-card.rpg-best { background: linear-gradient(180deg, #12302a, #172228 60%); }
body.theme-dark .rpg-avoid > div { background: #2a1717; border-color: #4a2626; }
body.theme-dark .rpg-avoid b { color: #f4b4b4; }
body.theme-dark .rpg-avoid small { color: #e0c0c0; }
body.theme-dark .rpg-caution { background: #2e2412; color: #f0d29a; }

/* ── The printed page: licence line, A5, large text, pre-printed letterhead ── */
.rx-license { margin-top: 2px; font-size: 10.5px; font-weight: 800; color: var(--rxc); letter-spacing: .01em; }
.rx-print.rx-paper-a5 { width: 148mm; min-height: 205mm; padding: 9mm 10mm !important; }
.rx-print.rx-paper-a5 .rx-print-clinic h1 { font-size: 17px; }
.rx-print.rx-paper-a5 .rx-logo-img { width: 44px; height: 44px; }
.rx-print.rx-paper-a5 .rx-print-pt-grid { grid-template-columns: 2fr 1fr 1.2fr; }
.rx-print.rx-paper-a5 .rx-print-pt-grid > div:nth-child(4) { grid-column: 1 / -1; border-top: 1px solid #dbe3e6; }
.rx-print.rx-fs-lg .rx-print-med-name { font-size: 15.5px !important; }
.rx-print.rx-fs-lg .rx-print-regimen b { font-size: 12.5px !important; }
.rx-print.rx-fs-lg .rx-print-regimen small { font-size: 10px !important; }
.rx-print.rx-fs-lg .rx-print-instructions, .rx-print.rx-fs-lg .rx-print-notes { font-size: 12px !important; }
.rx-print.rx-fs-lg .rx-print-pt-grid b { font-size: 13px !important; }
.rx-print.rx-fs-lg .rx-print-med-no { width: 26px; height: 26px; font-size: 12px; }
.rx-print.rx-letterhead { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; padding-top: var(--lh-top, 45mm) !important; padding-bottom: var(--lh-bot, 25mm) !important; }
.rx-print.rx-letterhead .rx-print-head, .rx-print.rx-letterhead .rx-rule, .rx-print.rx-letterhead .rx-foot { display: none !important; }
#rps-preview .rx-print.rx-letterhead::before, #rps-preview .rx-print.rx-letterhead::after { content: ''; position: absolute; inset-inline: 0; background: repeating-linear-gradient(45deg, #e9eff2 0 6px, #f6f9fa 6px 12px); border-bottom: 1px dashed #b8ccd5; }
#rps-preview .rx-print.rx-letterhead::before { top: 0; height: var(--lh-top, 45mm); }
#rps-preview .rx-print.rx-letterhead::after { bottom: 0; height: var(--lh-bot, 25mm); border-bottom: 0; border-top: 1px dashed #b8ccd5; }
.rx-test-ruler { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 11px; color: #345b68; }
.rx-test-ruler i { width: 10mm; height: 10mm; border: 1px solid #12333f; }
@media print {
  .rx-print.rx-paper-a5 { width: 148mm !important; min-height: 208mm !important; }
  .rx-print.rx-paper-a4 { width: 210mm; }
  #rpq-badge, .rps-overlay { display: none !important; }
}

/* ── Smart Rx name suggestions: full medicine names, one per row on phones ── */
#rxp-overlay .rxf-name-suggestions { max-height: 268px; gap: 6px; padding: 6px; }
#rxp-overlay .rxf-name-suggestion { min-height: 52px; padding: 7px 10px; gap: 2px 8px; }
#rxp-overlay .rxf-name-suggestion b { direction: ltr; unicode-bidi: isolate; text-align: start; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 12.5px; line-height: 1.3; }
#rxp-overlay .rxf-name-suggestion small { direction: ltr; unicode-bidi: isolate; text-align: start; font-size: 10.5px; }
#rxp-overlay .rxf-name-suggestion span { align-self: center; font-size: 11px; padding: 6px 10px; border-radius: 999px; background: #e8f8f3; }
@media (max-width: 520px) {
  #rxp-overlay .rxf-name-suggestions { grid-template-columns: 1fr; }
}
/* Regimen hints are examples, not values — keep them visibly faint so an empty field never looks filled. */
#rxp-overlay [data-med-field]::placeholder { color: #9fb0b7 !important; opacity: 1; font-style: italic; font-weight: 500; }
body.theme-dark #rxp-overlay [data-med-field]::placeholder { color: #5d717a !important; }
/* Standard adult regimen hint on a Smart Rx card */
#rxp-overlay .dg-std-badge { margin: 6px 0 2px; padding: 6px 10px; border-radius: 10px; background: #eef8f5; border: 1px solid #cfeae2; color: #0b5e4f; font-size: 11.5px; font-weight: 800; line-height: 1.5; }
body.theme-dark #rxp-overlay .dg-std-badge { background: #12302a; border-color: #1e4a40; color: #bfe9dc; }
.rpo-links .rpo-later { background: transparent; color: #6b8590; }
