/* Hapten: cool clinical ground, Sidi Bou Said blue as the one accent; avoid / safe colours are semantic only */
:root {
  --bg: #f5f7f9; --surface: #ffffff; --surface-2: #eef2f6; --ink: #0f1c2b; --muted: #5a6879; --line: #dfe5ec;
  --accent: #1b5aa0; --accent-ink: #ffffff; --accent-soft: #e6eef8;
  --avoid: #a8432a; --avoid-soft: #fbeee9; --ok: #2b7149; --ok-soft: #e7f3eb; --warn: #855c00; --warn-soft: #faf2df;
  --shadow: 0 1px 2px rgba(15, 28, 43, .05), 0 8px 24px rgba(15, 28, 43, .06);
  --latin: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --arabic: "IBM Plex Sans Arabic", "Noto Sans Arabic", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720; --surface: #16212d; --surface-2: #1c2937; --ink: #e7edf3; --muted: #9aa9b9; --line: #273546;
    --accent: #7fb0ea; --accent-ink: #0d1b2b; --accent-soft: #1b2e45;
    --avoid: #ee9479; --avoid-soft: #3a221b; --ok: #82cba0; --ok-soft: #17301f; --warn: #e3b75c; --warn-soft: #352a12;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--latin); }
html[lang="ar"] body { font-family: var(--arabic); }
[lang="ar"] { font-family: var(--arabic); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 20px; }
@media (max-width: 520px) { .wrap { padding-inline: 16px; } }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 1080px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-family: var(--latin); font-weight: 700; font-size: 1.22rem; letter-spacing: -.02em; }
.brand .mark { width: 28px; height: 28px; color: var(--accent); }
.switches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; }
.seg-label { font-size: .78rem; color: var(--muted); padding-inline: 10px 4px; white-space: nowrap; }
.seg button { border: 0; background: transparent; border-radius: 6px; padding: 5px 13px; cursor: pointer; font-size: .9rem; font-weight: 500; color: var(--muted); line-height: 1.4; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 560px) {
  .top-in { padding: 8px 16px; }
  .switches { width: 100%; justify-content: space-between; }
  .seg-label { display: none; }
}

/* intro + controls */
.intro { padding-block: 28px 4px; max-width: 44rem; }
.intro h1 { font-size: 1.45rem; line-height: 1.3; margin: 0 0 4px; font-weight: 650; letter-spacing: -.01em; }
html[lang="ar"] .intro h1 { letter-spacing: 0; }
.intro p { margin: 0; color: var(--muted); font-size: .96rem; }
.controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 8px; margin-block: 18px 6px; position: sticky; top: 61px; z-index: 10; padding-block: 8px; background: var(--bg); }
@media (max-width: 720px) { .controls { grid-template-columns: 1fr; top: 57px; } }
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding-inline: 12px; }
.search:focus-within { border-color: var(--accent); }
.search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search input { border: 0; background: transparent; padding-block: 11px; width: 100%; min-width: 0; outline: none; font-size: 1rem; }
.select { position: relative; }
.select select { width: 100%; appearance: none; -webkit-appearance: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 11px 38px 11px 12px; font-size: .94rem; cursor: pointer; text-overflow: ellipsis; }
html[dir="rtl"] .select select { padding: 11px 12px 11px 38px; }
.select::after { content: ""; position: absolute; inset-inline-end: 15px; top: 50%; width: 7px; height: 7px; border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--muted); font-size: .86rem; min-height: 1.4em; margin-bottom: 4px; flex-wrap: wrap; }
.meta button { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: .86rem; }

/* list: a plain index, rows separated by rules */
.thead { display: flex; justify-content: space-between; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 4px 6px; border-bottom: 1.5px solid var(--ink); }
html[lang="ar"] .thead { letter-spacing: 0; font-size: .8rem; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
.card { display: flex; align-items: center; border-bottom: 1px solid var(--line); min-width: 0; }
.card a { flex: 1; min-width: 0; padding: 11px 4px; text-decoration: none; color: inherit; display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; }
.fr-col { display: flex; flex-direction: column; min-width: 0; flex: 1 1 12rem; }
.card a:hover .fr, .card a:hover .ar { color: var(--accent); }
.card .ar { font-family: var(--arabic); font-weight: 600; font-size: 1.04rem; line-height: 1.5; direction: rtl; text-align: right; flex: 0 1 auto; margin-inline-start: auto; }
.card .fr { font-size: .95rem; color: var(--ink); line-height: 1.4; }
.card .hit { font-family: var(--mono); font-size: .74rem; color: var(--accent); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick { flex: none; width: 46px; align-self: stretch; display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; }
.pick span { width: 20px; height: 20px; border-radius: 4px; border: 1.6px solid color-mix(in srgb, var(--muted) 75%, transparent); display: grid; place-items: center; }
.pick svg { width: 13px; height: 13px; color: var(--accent-ink); opacity: 0; }
.card.on .pick span { background: var(--accent); border-color: var(--accent); }
.card.on .pick svg { opacity: 1; }
.card.on .ar, .card.on .fr { color: var(--accent); }
.empty { padding: 40px 0; text-align: center; color: var(--muted); grid-column: 1 / -1; }

/* sheet view */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-block: 18px 6px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: .92rem; }
.back svg { width: 16px; height: 16px; }
html[dir="rtl"] .back svg { transform: scaleX(-1); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 7px; padding: 10px 16px; font-weight: 600; font-size: .94rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn svg { width: 17px; height: 17px; }
.btn-wide { width: 100%; padding-block: 13px; font-size: 1rem; }

.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: clamp(18px, 4vw, 40px); margin-block: 10px 28px; font-family: var(--arabic); }
.sheet-head { display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.sheet .eyebrow { margin: 0; font-size: .86rem; font-weight: 600; color: var(--accent); }
.sheet h2 { margin: 0; font-size: clamp(1.7rem, 5vw, 2.4rem); line-height: 1.3; font-weight: 700; text-wrap: balance; }
.sheet .frname { font-family: var(--latin); direction: ltr; text-align: right; color: var(--muted); font-size: .95rem; }
.sheet .tests { font-family: var(--mono); direction: ltr; text-align: right; color: var(--muted); font-size: .74rem; line-height: 1.55; margin-top: 4px; }
.sheet .what { font-size: 1.12rem; line-height: 1.85; margin: 18px 0; max-width: 60rem; }
.labels { background: var(--warn-soft); border-radius: 12px; padding: 14px 16px; }
.labels p { margin: 0 0 9px; color: var(--warn); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; direction: ltr; justify-content: flex-end; }
.tags span { font-family: var(--mono); font-size: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; margin-top: 22px; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.cols > div { min-width: 0; }
.blk { margin-bottom: 20px; }
.blk h3 { display: flex; align-items: center; gap: 9px; margin: 0 0 9px; font-size: 1.08rem; }
.blk h3 i { font-style: normal; width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.blk h3 i svg { width: 15px; height: 15px; }
.blk ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.blk li { padding: 8px 13px; border-inline-start: 3px solid var(--line); border-radius: 3px; line-height: 1.75; }
.b-avoid h3 { color: var(--avoid); } .b-avoid h3 i { background: var(--avoid-soft); color: var(--avoid); } .b-avoid li { border-color: var(--avoid); background: var(--avoid-soft); }
.b-alt h3 { color: var(--ok); } .b-alt h3 i { background: var(--ok-soft); color: var(--ok); } .b-alt li { border-color: var(--ok); }
.lt { font-family: var(--mono); font-size: .86em; }
.nw { white-space: nowrap; }
.sheet .note { margin: 6px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }

/* footer */
.foot { padding-block: 34px calc(110px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: .86rem; border-top: 1px solid var(--line); margin-top: 30px; }
.foot p { margin: 0 0 4px; max-width: 46rem; }
.foot-small { font-size: .8rem; }

/* tray */
.tray { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
.tray-in { pointer-events: auto; max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--ink); color: var(--bg); border-radius: 10px; padding: 8px 8px 8px 16px; box-shadow: 0 8px 24px rgba(15,28,43,.22); animation: up .22s ease-out; }
html[dir="rtl"] .tray-in { padding: 10px 18px 10px 10px; }
.tray p { margin: 0; font-size: .92rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray p b { font-weight: 700; }
.tray .btn { background: var(--bg); color: var(--ink); border-color: var(--bg); }
@keyframes up { from { transform: translateY(14px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tray-in { animation: none; } .card { transition: none; } }

/* selection dialog */
dialog { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100dvh; color: var(--ink); }
dialog::backdrop { background: rgba(10, 18, 28, .45); }
.sel-in { width: min(560px, 100vw - 24px); max-height: calc(100dvh - 40px); overflow: auto; background: var(--surface); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
@media (max-width: 560px) {
  dialog { margin: auto 0 0; width: 100vw; }
  .sel-in { width: 100vw; max-height: 92dvh; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
}
.sel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sel-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.01em; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn svg { width: 18px; height: 18px; }
.sel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sel-list li { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 11px; padding: 8px 8px 8px 14px; min-width: 0; }
html[dir="rtl"] .sel-list li { padding: 8px 14px 8px 8px; }
.sel-list .names { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sel-list .names .ar { font-family: var(--arabic); font-weight: 600; direction: rtl; text-align: right; }
.sel-list .names .fr { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-list button { width: 32px; height: 32px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none; }
.sel-list button svg { width: 15px; height: 15px; }
.sel-empty { color: var(--muted); font-size: .92rem; margin: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields label, .field-ver { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; color: var(--muted); font-weight: 500; min-width: 0; }
.fields label:first-child { grid-column: 1 / -1; }
.fields input { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 11px 12px; font-size: 1rem; color: var(--ink); width: 100%; min-width: 0; }
.fields input:focus { outline: none; border-color: var(--accent); }
.seg-inline { align-self: flex-start; }
@media (max-width: 420px) { .fields { grid-template-columns: 1fr; } }
.hint { margin: -4px 0 0; font-size: .82rem; color: var(--muted); }
.sel-actions { display: flex; flex-direction: column; gap: 8px; }
.status { margin: 0; min-height: 1.2em; font-size: .86rem; color: var(--muted); text-align: center; }
.share { border-top: 1px solid var(--line); padding-top: 12px; }
.share summary { cursor: pointer; font-weight: 600; font-size: .94rem; }
.share-in { display: flex; gap: 16px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.share .qr { background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--line); flex: none; }
.share .qr img, .share .qr canvas { width: 132px; height: 132px; display: block; }
.share-txt { flex: 1 1 220px; min-width: 0; font-size: .88rem; color: var(--muted); }
.share-txt p { margin: 0 0 8px; }
.copy { display: flex; gap: 6px; }
.copy input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 8px 10px; font-family: var(--mono); font-size: .76rem; color: var(--ink); }
.link-btn { align-self: center; background: none; border: 0; color: var(--muted); font-size: .86rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.foot-credit { margin-top: 14px !important; font-size: .82rem; color: var(--ink); opacity: .8; }
html[dir="rtl"] .card a { flex-direction: row-reverse; }
html[dir="rtl"] .card .ar { margin-inline-start: 0; margin-inline-end: auto; }
html[dir="rtl"] .sel-list .names .fr { text-align: right; }
.actions .seg { align-self: center; }
@media (max-width: 560px) { .actions .seg-label { display: none; } .switches { width: auto; } }


/* ---- shared look with medtravail.com ---- */
:root {
  --bg: #f7f8f6; --surface: #ffffff; --surface-2: #eef2f2; --ink: #18242b; --muted: #5b6a72; --line: #d8dfe0;
  --accent: #1c4f7a; --accent-ink: #ffffff; --accent-soft: #e3ecf4;
  --avoid: #a3302a; --avoid-soft: #f8e3e1; --ok: #1f7a4d; --ok-soft: #e2f2e9; --warn: #9a6200; --warn-soft: #fbf0d9;
  --latin: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1518; --surface: #162026; --surface-2: #1b262c; --ink: #e3eaec; --muted: #9aaab1; --line: #2a373e;
    --accent: #7fb3e0; --accent-ink: #0b1a26; --accent-soft: #1d3346;
    --avoid: #ef8a83; --avoid-soft: #3a1d1b; --ok: #6fcf9b; --ok-soft: #173326; --warn: #e8b45a; --warn-soft: #352812;
  }
}
body { font-size: 15px; line-height: 1.55; }
html[lang="ar"] body { font-size: 16px; }
.intro h1, .sel-head h2 { font-family: var(--display); font-weight: 700; letter-spacing: 0; }
html[lang="ar"] .intro h1, html[lang="ar"] .sel-head h2 { font-family: var(--arabic); }
.intro h1 { font-size: clamp(1.7rem, 4vw, 2.2rem); line-height: 1.2; margin-bottom: 8px; }
.top { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
.top-in { max-width: 1080px; }
.brand { gap: 10px; font-weight: 400; letter-spacing: 0; }
.brand .seal { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center; flex: none; }
.brand .seal .mark { width: 20px; height: 20px; }
.brand .bt { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-family: var(--display); font-size: 1.05rem; font-weight: 700; }
.brand small { color: var(--muted); font-size: .78rem; font-family: var(--latin); }
html[lang="ar"] .brand small { font-family: var(--arabic); }
.mt-link { margin-inline-end: auto; font-size: .85rem; color: var(--accent); text-underline-offset: 2px; white-space: nowrap; }
.seg { border: 1.5px solid var(--accent); border-radius: 999px; padding: 3px; }
.seg button { border-radius: 999px; padding: 6px 14px; color: var(--ink); min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.btn { border-radius: 6px; font-weight: 500; }
.search, .select select, .fields input, .copy input { border-radius: 6px; }
.sheet { border-radius: 8px; }
.labels { border-radius: 8px; }
.foot { text-align: center; font-size: .8rem; display: grid; justify-items: center; gap: 4px; padding-top: 14px; margin-top: 36px; }
.foot p { margin: 0; }
.foot-credit { margin-top: 0 !important; font-size: .8rem; color: var(--muted); opacity: 1; }
@media (max-width: 560px) { .mt-link { order: 3; width: 100%; } }
.controls { top: 62px; }
@media (max-width: 560px) { .controls { top: 91px; } }
