/* ==========================================================================
   Patient area — upload, explanation reader, files, journey
   ========================================================================== */

.app__head { max-width: 62ch; margin-bottom: var(--s6); }
.app__head h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); }

main.section > form > .card + .card,
main.section > form > .card + .progress-box { margin-top: var(--s4); }

/* ---- Dropzone ------------------------------------------------------------ */

.drop__title { font-weight: 600; color: var(--navy); margin-bottom: var(--s1); }

/* ---- Picked files -------------------------------------------------------- */

.files { list-style: none; padding: 0; margin: var(--s4) 0 0; }
.files:empty { margin: 0; }
.file {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3); border: 1px solid var(--grey-200);
  border-radius: var(--r); background: var(--white);
}
.file + .file { margin-top: var(--s2); }
.file__icon { font-size: 1.15rem; }
.file__name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .92rem;
}
.file__size { flex: 0 0 auto; }
.file__x {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: var(--r-sm);
  border: 0; background: var(--grey-100); color: var(--grey-600);
  font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.file__x:hover { background: var(--red-soft); color: var(--red); }

/* ---- Progress ------------------------------------------------------------ */

.progress-box {
  display: flex; align-items: center; gap: var(--s4);
  background: var(--blue-soft); border: 1px solid var(--blue-line);
  border-radius: var(--r-lg); padding: var(--s5);
}

/* ---- Result -------------------------------------------------------------- */

.result { margin-top: var(--s5); }
.result > * + * { margin-top: var(--s4); }

.result__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3);
}
.result__head .card__title { margin: 0; }
.result__summary { font-size: 1.08rem; margin: 0; }

/* Findings — status colour is meaning, not decoration.
   "attention" means "worth asking your doctor about", never "this is bad". */
.findings { list-style: none; padding: 0; margin: 0; }
.finding {
  padding: var(--s4); border-radius: var(--r);
  border-inline-start: 3px solid var(--grey-200); background: var(--grey-100);
}
.finding + .finding { margin-top: var(--s3); }
.finding--normal    { border-inline-start-color: var(--teal);  background: var(--teal-soft); }
.finding--attention { border-inline-start-color: var(--amber); background: var(--amber-soft); }
.finding--unknown   { border-inline-start-color: var(--grey-400); }

.finding__row {
  display: flex; align-items: center; gap: var(--s3);
  flex-wrap: wrap; margin-bottom: var(--s2);
}
.finding__label { font-weight: 600; }
.finding__value {
  font-variant-numeric: tabular-nums;
  background: var(--white); border-radius: var(--r-sm);
  padding: 2px 8px; font-size: .92rem;
}
.finding__plain { margin: 0; font-size: .94rem; }

/* Glossary */
.terms { margin: 0; }
.terms dt { font-weight: 600; color: var(--navy); }
.terms dd { margin: 0 0 var(--s3); padding-inline-start: 0; }
.terms dd:last-child { margin-bottom: 0; }

/* Next steps are QUESTIONS for the doctor, never instructions. */
.next { margin: 0; padding-inline-start: var(--s5); }
.next li + li { margin-top: var(--s2); }

/* ---- Conversion block — step 2 of the funnel ----------------------------- */

.convert {
  background: var(--blue-soft); border-color: var(--blue-line);
  border-inline-start: 4px solid var(--blue); box-shadow: none;
}
.convert .card__title { color: var(--navy); }

/* ---- Funnel progress rail (dossier + journey pages) ---------------------- */

.rail { display: grid; gap: var(--s2); margin-bottom: var(--s6); }
.rail__step {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); border-radius: var(--r);
  background: var(--grey-100); color: var(--grey-600); font-size: .94rem;
}
.rail__step--done   { background: var(--teal-soft); color: var(--teal); font-weight: 600; }
.rail__step--todo   { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.rail__step--locked { opacity: .6; }
.rail__dot {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: .75rem;
  background: var(--white); border: 1px solid currentColor;
}
@media (min-width: 760px) { .rail { grid-template-columns: repeat(3, 1fr); } }

/* ==========================================================================
   Patient dashboard — app/dossier.html

   A rail on the left and one panel at a time on the right, the way the admin
   works, because a patient's file has the same shape as a case file: a status,
   some readings, some documents, a trip and a person.

   Below 900 px the rail becomes a horizontal scroller across the top. It is
   never a hamburger: five destinations you can see beat five you have to open
   a menu to find, and most of this audience is on a phone.
   ========================================================================== */

.dash__head { margin-bottom: var(--s6); }
.dash__head h1 { margin-bottom: var(--s2); }
.dash__head .lead { margin: 0; }

.dash { display: grid; gap: var(--s6); align-items: start; }
@media (min-width: 900px) { .dash { grid-template-columns: 264px minmax(0, 1fr); } }

.dash__side { position: sticky; top: calc(var(--nav-h) + var(--s4)); }
@media (max-width: 899px) { .dash__side { position: static; } }

/* ---- The side panel -------------------------------------------------------
   One card: who you are on a navy head, the destinations under it. Same shape
   as mimitamie's account area and the 3aychek seller dashboard — a panel you
   read once and then navigate from, rather than a list of links floating on
   the page background.
   -------------------------------------------------------------------------- */

.dash__side {
  background: var(--white); border: 1px solid var(--grey-200);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--e2, var(--shadow));
}

.dash__me {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s5) var(--s4);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(23,183,183,.35) 0%, transparent 60%),
    linear-gradient(150deg, #123C74 0%, #071D3D 100%);
  color: var(--white);
}
.dash__avatar {
  flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: var(--blue); color: var(--white); font-weight: 700; font-size: 1.15rem;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35), 0 6px 16px rgba(0,0,0,.35);
}
.dash__avatar img { width: 100%; height: 100%; object-fit: cover; }
.dash__who { min-width: 0; display: block; }
.dash__who strong { display: block; font-size: .98rem; }
.dash__who small {
  display: block; color: #9FB4CE; font-size: .78rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- The destinations ------------------------------------------------------
   Below 900 px this becomes a horizontal scroller across the top. Never a
   hamburger: five destinations you can see beat five you have to open a menu
   to find, and most of this audience is on a phone.
   -------------------------------------------------------------------------- */

.dash__tabs { display: grid; gap: 2px; padding: var(--s2); }
@media (max-width: 899px) {
  .dash__tabs {
    grid-auto-flow: column; grid-auto-columns: max-content;
    overflow-x: auto; gap: var(--s2);
    -webkit-overflow-scrolling: touch;
  }
}

.dash__tab {
  position: relative;
  display: flex; align-items: center; gap: var(--s3);
  padding: 11px var(--s3); border-radius: var(--r);
  color: var(--grey-900); font-size: .95rem; font-weight: 500;
  white-space: nowrap;
  transition: background-color .18s, color .18s;
}
.dash__tab:hover { background: var(--grey-100); text-decoration: none; }
.dash__tab.is-on { background: var(--blue-soft); color: var(--blue); font-weight: 600; }

/* The active marker: a bar on the reading edge, so the eye finds where it is
   without relying on the fill alone. */
.dash__tab.is-on::before {
  content: ''; position: absolute;
  inset-inline-start: 0; inset-block: 8px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--blue);
}
@media (max-width: 899px) {
  .dash__tab.is-on::before { inset: auto 12px 0 12px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
}

/* Icons sit on a tinted disc, which is what stops a list of glyphs reading as
   clip art. */
.dash__tabIcon {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .95rem; color: var(--grey-600); background: var(--grey-100);
  transition: background-color .18s, color .18s;
}
.dash__tab.is-on .dash__tabIcon { background: var(--blue); color: var(--white); }

/* ---- Panels --------------------------------------------------------------- */

.dash__panel[hidden] { display: none; }
.dash__h2 { font-size: 1.1rem; margin: var(--s6) 0 var(--s3); }
.dash__panel > .dash__h2:first-child { margin-top: 0; }

.dash__cardhead {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3);
}
.dash__next {
  margin: var(--s4) 0 0; padding: var(--s3) var(--s4);
  background: var(--blue-soft); border-inline-start: 3px solid var(--blue);
  border-radius: var(--r-sm); font-size: .95rem;
}

/* ---- Status timeline ------------------------------------------------------
   The one question this page exists to answer is "where is my file". A badge
   says the answer; a timeline shows the road, which is what someone waiting
   four days actually needs to see.
   -------------------------------------------------------------------------- */

.tsteps { list-style: none; margin: var(--s4) 0 0; padding: 0; position: relative; }
.tsteps::before {
  content: ''; position: absolute; inset-block: 10px;
  inset-inline-start: 6px; width: 2px; background: var(--grey-200);
}
.tstep {
  position: relative; padding-inline-start: var(--s6); padding-block: 0 var(--s4);
  color: var(--grey-400);
}
.tstep:last-child { padding-block-end: 0; }
.tstep strong { display: block; font-size: .95rem; font-weight: 600; }
.tstep::before {
  content: ''; position: absolute; inset-block-start: 6px; inset-inline-start: 0;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--white); border: 2px solid var(--grey-200);
}
.tstep.is-done { color: var(--grey-600); }
.tstep.is-done::before { background: var(--teal); border-color: var(--teal); }
.tstep.is-active { color: var(--navy); }
.tstep.is-active strong { color: var(--blue); }
.tstep.is-active::before {
  background: var(--blue); border-color: var(--blue);
  box-shadow: 0 0 0 0 rgba(11,99,176,.5); animation: tpulse 2.2s infinite;
}
@keyframes tpulse { 70% { box-shadow: 0 0 0 10px rgba(11,99,176,0); } }

/* ---- The professor's answer ----------------------------------------------- */

.proforma {
  margin-top: var(--s5); padding: var(--s5);
  background: var(--teal-soft); border-radius: var(--r);
  border-inline-start: 4px solid var(--teal);
}
.proforma__title { font-size: 1rem; margin-bottom: var(--s3); color: var(--teal); }
.proforma__note { font-size: .95rem; }
.proforma__amount { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s1); }
.proforma__amount b { font-size: 1.5rem; color: var(--navy); font-variant-numeric: tabular-nums; }

/* ---- Explanations ---------------------------------------------------------
   Kept in the language they were produced in — an Arabic reading stays Arabic
   even after the patient switches the site to French, so the block sets its own
   lang and dir rather than inheriting the page's.
   -------------------------------------------------------------------------- */

/* The list of past explanations lives further down, under "The explanation, as
   a reading" — .xbar, .xmonth and .xrow. */

.linklike {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--blue); font: inherit; font-size: .92rem; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---- Documents ------------------------------------------------------------ */

.file__dl {
  margin-inline-start: auto; flex: 0 0 auto; cursor: pointer;
  border: 1px solid var(--blue-line); background: var(--white); color: var(--blue);
  border-radius: var(--r-full); padding: 4px 12px; font-size: .8rem; font-weight: 600;
}
.file__dl:hover { background: var(--blue-soft); }
.file__dl[disabled] { opacity: .5; cursor: default; }

/* ---- Arrival --------------------------------------------------------------
   Only rendered once the trip is actually organised. Until then this block
   would be a promise, and "someone will meet you at the airport" must never
   appear before someone will.
   -------------------------------------------------------------------------- */

.arrival__img {
  width: 100%; max-height: 300px; object-fit: cover;
  border-radius: var(--r); margin-bottom: var(--s4);
}
.arrival__text { font-size: .98rem; white-space: pre-line; }
.arrival__where { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--s3); }
.arrival__where strong { font-size: 1.05rem; color: var(--navy); }
.arrival__note {
  padding: var(--s3) var(--s4); background: var(--grey-100);
  border-radius: var(--r-sm); font-size: .94rem; white-space: pre-line;
}

.care { display: grid; gap: var(--s4); }
@media (min-width: 620px) { .care { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.care__item {
  display: flex; gap: var(--s4); align-items: flex-start;
  padding: var(--s4); border: 1px solid var(--grey-200); border-radius: var(--r);
}
.care__img {
  flex: 0 0 auto; width: 72px; height: 72px;
  object-fit: cover; border-radius: var(--r-sm);
}
.care__item strong { display: block; color: var(--navy); }

/* ---- Calculator result --------------------------------------------------- */

.tool__out { border-inline-start: 4px solid var(--teal); }
.tool__label {
  margin: 0; font-size: .85rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--grey-600);
}
.tool__value {
  margin: var(--s2) 0 var(--s3);
  font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 700;
  color: var(--navy); line-height: 1.15;
}
.tool__value small { font-size: .42em; font-weight: 500; color: var(--grey-600); }

/* ---- Progress bar -------------------------------------------------------- */

.progress {
  position: relative; height: 6px; border-radius: var(--r-full);
  background: var(--grey-200); overflow: hidden;
}
.progress__fill {
  position: absolute; inset-block: 0; inset-inline-start: 0;
  background: var(--blue); border-radius: var(--r-full);
  transition: width .3s;
}

/* ---- Login --------------------------------------------------------------- */

.auth { display: grid; place-items: center; min-height: 60vh; }
.auth__card { width: 100%; max-width: 440px; }
.auth__head { margin-bottom: var(--s5); }
.auth__head h1 { font-size: 1.5rem; margin-bottom: var(--s2); }
.auth__head p { margin: 0; font-size: .94rem; }

.auth__google { justify-content: center; }
.auth__google svg { flex: 0 0 auto; }

.auth__or {
  display: flex; align-items: center; gap: var(--s3);
  margin: var(--s5) 0; color: var(--grey-400); font-size: .85rem;
}
.auth__or::before, .auth__or::after {
  content: ''; flex: 1 1 auto; height: 1px; background: var(--grey-200);
}

.auth__links {
  display: flex; justify-content: space-between; gap: var(--s3);
  flex-wrap: wrap; margin-top: var(--s4);
}
.linklike {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--blue); font-size: .9rem; font-weight: 500; text-align: start;
}
.linklike:hover { text-decoration: underline; }
.linklike[hidden] { display: none; }

.auth__legal {
  margin: var(--s5) 0 0; padding-top: var(--s4);
  border-top: 1px solid var(--grey-200); line-height: 1.6;
}

/* ---- Second opinion form ------------------------------------------------- */

.opinion__docs {
  background: var(--blue-soft); border: 1px solid var(--blue-line);
  border-radius: var(--r); padding: var(--s4);
}
.opinion__docs .files { margin-top: var(--s3); }
.opinion__docs .file { background: var(--white); }

.row { display: grid; gap: var(--s4); }
@media (min-width: 620px) { .row--2 { grid-template-columns: 1fr 1fr; } }

/* The submitted state: what happens next, and when. */
.timeline { list-style: none; padding: 0; margin: var(--s5) 0 0; }
.timeline li {
  position: relative; padding-inline-start: var(--s6);
  padding-block: var(--s3); font-size: .95rem;
}
.timeline li::before {
  content: ''; position: absolute; inset-inline-start: 7px; top: 0; bottom: 0;
  width: 2px; background: var(--grey-200);
}
.timeline li:first-child::before { top: 50%; }
.timeline li:last-child::before { bottom: 50%; }
.timeline li::after {
  content: ''; position: absolute; inset-inline-start: 2px; top: calc(50% - 6px);
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--white); border: 2px solid var(--grey-200);
}
.timeline li.is-done::after   { background: var(--teal);  border-color: var(--teal); }
.timeline li.is-active::after { background: var(--blue);  border-color: var(--blue); }
.timeline li.is-active { font-weight: 600; color: var(--navy); }

/* ---- Legal pages --------------------------------------------------------- */

.legal { max-width: 74ch; }
.legal h1 { margin-bottom: var(--s2); }
.legal .lead { margin-block: var(--s5); }
.legal__s { margin-top: var(--s6); }
.legal__s h2 {
  font-size: 1.12rem; margin-bottom: var(--s3);
  padding-bottom: var(--s2); border-bottom: 1px solid var(--grey-200);
}
.legal__s p { font-size: .97rem; }
.legal__s ul { font-size: .97rem; }
.legal__s li + li { margin-top: var(--s2); }
.legal strong { color: var(--navy); }

/* ---- Guide article body -------------------------------------------------- */

.article { font-size: 1.04rem; }
.article h2 {
  font-size: 1.22rem; margin: var(--s6) 0 var(--s3);
  padding-bottom: var(--s2); border-bottom: 1px solid var(--grey-200);
}
.article p { margin: 0 0 var(--s4); }
.article ul { margin: 0 0 var(--s4); padding-inline-start: var(--s5); }
.article li + li { margin-top: var(--s2); }
.article strong { color: var(--navy); }

/* ---- Mobile -------------------------------------------------------------- */

@media (max-width: 620px) {
  .result__head { flex-direction: column; align-items: stretch; }
  .result__head .btn { width: 100%; }
  .finding__row { gap: var(--s2); }
  .auth__links { flex-direction: column; }
}

/* ---- The sign-in gate -------------------------------------------------------
   What a signed-out visitor sees where the upload form would be. It used to be
   a redirect to login.html, which on a slow connection reads as "the page just
   keeps loading" and then dumps you on a password box with no reason given.
   This says what we need and why, and it is the only thing on the screen.
   -------------------------------------------------------------------------- */

.signin {
  max-width: 560px; margin-inline: auto; text-align: center;
  padding: var(--s7) var(--s6);
}
.signin__icon {
  display: grid; place-items: center; width: 56px; height: 56px;
  margin: 0 auto var(--s5); border-radius: var(--r-full);
  background: var(--blue-soft); color: var(--blue);
}
.signin__icon svg { width: 26px; height: 26px; }
.signin__title { font-size: clamp(1.2rem, 2.6vw, 1.5rem); margin-bottom: var(--s3); }
.signin__body { color: var(--grey-600); margin-bottom: var(--s5); }

.signin__why {
  list-style: none; padding: 0; margin: 0 0 var(--s6);
  text-align: start; display: grid; gap: var(--s3);
}
.signin__why li {
  position: relative; padding-inline-start: var(--s6);
  font-size: .95rem; color: var(--grey-900);
}
/* A tick drawn in CSS — one less asset, and it mirrors in Arabic for free. */
.signin__why li::before {
  content: ''; position: absolute; inset-inline-start: 0; top: .45em;
  width: 12px; height: 7px; border: 2px solid var(--teal);
  border-block-start: 0; border-inline-end: 0; transform: rotate(-45deg);
}
.signin .hint { text-align: center; }

/* The funding progress bar. Two numbers and a line — a patient waiting on a
   collection wants "how much is in" answered in one glance. */
.fundbar {
  height: 10px; border-radius: var(--r-full); overflow: hidden;
  background: var(--grey-100); margin-top: var(--s4);
}
.fundbar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  transition: width .5s cubic-bezier(.22,.61,.36,1);
}

/* The consent block on financement.html — a fieldset, because these really are
   separate permissions and a screen reader should announce them as a group. */
.fund__consent {
  border: 1px solid var(--grey-200); border-radius: var(--r);
  padding: var(--s5); margin-bottom: var(--s5);
}
.fund__consent legend { font-weight: 600; color: var(--navy); padding-inline: var(--s2); }
.fund__consent .consent { margin-bottom: var(--s4); }
.fund__next { margin: var(--s4) 0; padding-inline-start: var(--s5); }
.fund__next li + li { margin-top: var(--s2); }
