/* patient.css — the patient-facing experience (upload → verify → results).
   Loaded AFTER app.css, which supplies the Explicor palette tokens, the reset and Inter.
   Scoped under .pt-body / .pt-* so nothing here can reach the Pro workspace or admin.

   Display headings use a serif to match the design mockups; the stack degrades to Georgia
   when the webfont is unavailable (offline/local), which keeps the serif character. */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&display=swap');

.pt-body {
  --pt-page: #f6f9fb;
  --pt-card: #ffffff;
  --pt-line: #e6edf2;
  --pt-line-soft: #eff4f7;
  --pt-ink: #12314e;
  --pt-body-ink: #33485c;
  --pt-muted: #5f7488;
  --pt-accent: #1a7f96;
  --pt-accent-soft: #eaf6f9;
  --pt-warn: #fbf3dc;
  --pt-warn-line: #e8cf8f;
  --pt-warn-ink: #7a5a12;
  --pt-ok: #e8f6ee;
  --pt-ok-ink: #1c6b42;
  --pt-shadow: 0 10px 40px rgba(18, 49, 78, 0.07);
  --pt-shadow-lift: 0 16px 46px rgba(18, 49, 78, 0.12);
  --pt-serif: 'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;

  background: var(--pt-page);
  color: var(--pt-body-ink);
  /* Respect notches/home indicator on phones (viewport-fit=cover). */
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------------------------------------------------------------- a11y */

.pt-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--pt-ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 0 0 10px 0;
}
.pt-skip:focus { left: 0; }

/* The `hidden` attribute is only a UA rule of `display: none`, so ANY later `display`
   declaration on the same element silently defeats it — which is how the modal and the
   file chip both rendered on load. Every view/panel here toggles via `hidden`, so make it
   win outright. */
.pt-body [hidden] { display: none !important; }

.pt-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* One consistent, high-contrast focus ring everywhere. */
.pt-body :focus-visible {
  outline: 3px solid var(--pt-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .pt-body *, .pt-body *::before, .pt-body *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------- header */

.pt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 44px);
  background: #fff;
  border-bottom: 1px solid var(--pt-line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.pt-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }

.pt-brand-mark {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--grad-logo, linear-gradient(150deg, #0e2a47, #123a5c));
  display: grid; place-items: center;
  flex: none;
}
.pt-brand-mark svg { width: 26px; height: 26px; }

.pt-brand-word {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--pt-ink);
}

.pt-nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 34px); }
.pt-nav a {
  color: var(--pt-body-ink);
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 500;
  padding: 8px 2px;
}
.pt-nav a:hover { color: var(--pt-accent); }

/* On phones the nav would crowd the logo; drop the two in-page anchors and keep
   the one link that leaves the patient flow. */
@media (max-width: 640px) {
  .pt-nav a[href^="#"] { display: none; }
}

/* ---------------------------------------------------------------- layout */

#pt-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 60px) clamp(16px, 4vw, 32px) 40px;
}

.pt-hero { text-align: center; margin-bottom: clamp(26px, 4vw, 40px); }
.pt-hero-tight { margin-bottom: clamp(20px, 3vw, 30px); }

.pt-display {
  font-family: var(--pt-serif);
  font-weight: 600;
  font-size: clamp(2.3rem, 6.2vw, 4.2rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--pt-ink);
  margin-bottom: 18px;
}
.pt-display-sm { font-size: clamp(2rem, 4.6vw, 3.1rem); }

.pt-lead {
  max-width: 620px;
  margin: 0 auto;
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  line-height: 1.6;
  color: var(--pt-muted);
}
.pt-lead-tight { margin: 0; }

.pt-card {
  background: var(--pt-card);
  border: 1px solid var(--pt-line);
  border-radius: 20px;
  box-shadow: var(--pt-shadow);
}

.pt-eyebrow {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pt-muted);
  margin-bottom: 14px;
}

.pt-label {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--pt-ink);
  margin-bottom: 8px;
}
.pt-optional { font-weight: 400; color: var(--pt-muted); }

/* ---------------------------------------------------------------- upload */

.pt-upload-card {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 30px);
}

.pt-drop {
  border: 2px dashed #bcd9e6;
  border-radius: 16px;
  background: #fbfdfe;
  padding: clamp(28px, 5vw, 46px) 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.pt-drop:hover, .pt-drop.is-over {
  border-color: var(--pt-accent);
  background: var(--pt-accent-soft);
}
.pt-drop-icon {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: #e2f1f7;
  color: var(--pt-accent);
  display: grid; place-items: center;
  margin-bottom: 4px;
}
.pt-drop-icon svg { width: 28px; height: 28px; }
.pt-drop-title { font-weight: 700; color: var(--pt-ink); font-size: 1.02rem; }
.pt-drop-sub { color: var(--pt-muted); font-size: 0.9rem; }

/* Drag-and-drop is pointer-only; on touch the tiles below are the real affordance. */
@media (hover: none) {
  .pt-drop-title { font-size: 0.98rem; }
  .pt-drop { padding: 22px 16px; }
}

.pt-or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--pt-muted);
  font-size: 0.92rem;
}
.pt-or::before, .pt-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--pt-line);
}

.pt-routes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 700px) {
  .pt-routes { grid-template-columns: 1fr; }
}

.pt-route {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px;
  min-height: 68px;           /* comfortable tap target */
  border: 1px solid var(--pt-line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.pt-route:hover {
  border-color: var(--pt-accent);
  box-shadow: var(--pt-shadow);
  transform: translateY(-1px);
}
.pt-route.is-on { border-color: var(--pt-accent); background: var(--pt-accent-soft); }
.pt-route-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--pt-accent-soft);
  color: var(--pt-accent);
  display: grid; place-items: center;
  flex: none;
}
.pt-route-icon svg { width: 22px; height: 22px; }
.pt-route-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pt-route-text strong { color: var(--pt-ink); font-size: 0.98rem; }
.pt-route-text small { color: var(--pt-muted); font-size: 0.85rem; }

/* chosen file */
.pt-file {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--pt-line);
  border-radius: 14px;
  background: #fbfdfe;
  flex-wrap: wrap;
}
.pt-file-thumb, .pt-vf-thumb {
  width: 44px; height: 52px;
  border-radius: 8px;
  border: 1px solid var(--pt-line);
  background: #fff center/cover no-repeat;
  display: grid; place-items: center;
  color: var(--pt-accent);
  flex: none;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  overflow: hidden;
}
.pt-file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pt-file-meta strong { color: var(--pt-ink); overflow-wrap: anywhere; }
.pt-file-meta small { color: var(--pt-muted); }
.pt-file-status {
  background: var(--pt-ok);
  color: var(--pt-ok-ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
}
.pt-file-remove, .pt-linkish {
  background: none;
  border: 0;
  padding: 6px 4px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--pt-accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pt-paste { margin-top: 18px; }

.pt-body textarea, .pt-body .pt-select {
  width: 100%;
  font: inherit;
  color: var(--pt-body-ink);
  background: #fff;
  border: 1px solid var(--pt-line);
  border-radius: 12px;
  padding: 12px 14px;
  resize: vertical;
}
.pt-body textarea:focus, .pt-body .pt-select:focus { border-color: var(--pt-accent); }

.pt-cta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pt-privacy { display: flex; align-items: flex-start; gap: 12px; flex: 1 1 300px; }
.pt-privacy-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--pt-accent-soft);
  color: var(--pt-accent);
  display: grid; place-items: center;
  flex: none;
}
.pt-privacy-icon svg { width: 21px; height: 21px; }
.pt-privacy-icon-sm { width: 26px; height: 26px; border-radius: 8px; }
.pt-privacy-icon-sm svg { width: 15px; height: 15px; }
.pt-privacy strong { display: block; color: var(--pt-ink); font-size: 0.95rem; }
.pt-privacy p { font-size: 0.88rem; color: var(--pt-muted); line-height: 1.5; }
.pt-privacy .pt-linkish { font-size: 0.88rem; }

.pt-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 26px;
  min-height: 52px;
  border: 0;
  border-radius: 13px;
  background: var(--grad-cta, linear-gradient(135deg, #123a5c, #1fb2cb));
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--sh-cta, 0 12px 26px rgba(31, 178, 203, 0.26));
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.pt-primary:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.04); }
.pt-primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.pt-primary svg { width: 19px; height: 19px; }
.pt-primary-dark { background: linear-gradient(135deg, #0e2a47, #143d5f); }

.pt-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  min-height: 52px;
  border: 1px solid var(--pt-line);
  border-radius: 13px;
  background: #fff;
  color: var(--pt-ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pt-secondary:hover { border-color: var(--pt-accent); box-shadow: var(--pt-shadow); }

.pt-btn-ic { display: grid; place-items: center; flex: none; }
.pt-btn-ic svg { width: 20px; height: 20px; }
.pt-btn-text { display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.pt-btn-text small { font-size: 0.82rem; opacity: 0.82; font-weight: 400; }

.pt-focus { margin-top: 22px; }
.pt-focus-box { position: relative; }
.pt-focus-box textarea { padding-bottom: 28px; }
.pt-counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 0.8rem;
  color: var(--pt-muted);
  pointer-events: none;
}

.pt-error {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fdecec;
  border: 1px solid #f3c2c2;
  color: #8a2020;
  font-size: 0.92rem;
}

/* ---------------------------------------------------------------- how it works */

.pt-how { margin-top: clamp(38px, 6vw, 64px); }
.pt-how-title {
  text-align: center;
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--pt-ink);
  margin-bottom: 22px;
}
.pt-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  list-style: none;
}
@media (max-width: 760px) { .pt-steps { grid-template-columns: 1fr; } }
.pt-step {
  display: flex;
  gap: 14px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--pt-line);
  border-radius: 16px;
}
.pt-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--pt-ink);
  color: #fff;
  display: grid; place-items: center;
  font-size: 0.86rem;
  font-weight: 700;
  flex: none;
}
.pt-step strong { display: block; color: var(--pt-ink); margin-bottom: 4px; }
.pt-step p { font-size: 0.9rem; color: var(--pt-muted); line-height: 1.5; }

/* ---------------------------------------------------------------- verify */

.pt-verify {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) { .pt-verify { grid-template-columns: 1fr; } }

.pt-verify-file, .pt-verify-text { padding: clamp(16px, 2.4vw, 24px); }

.pt-vf-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.pt-vf-head strong { display: block; color: var(--pt-ink); overflow-wrap: anywhere; }
.pt-vf-head small { color: var(--pt-muted); font-size: 0.86rem; }

.pt-vf-status {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--pt-ok);
  margin-bottom: 14px;
}
.pt-tick {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  color: var(--pt-ok-ink);
  display: grid; place-items: center;
  flex: none;
}
.pt-tick svg { width: 15px; height: 15px; }
.pt-vf-status strong { display: block; color: var(--pt-ok-ink); font-size: 0.92rem; }
.pt-vf-status small { color: var(--pt-ok-ink); opacity: 0.8; font-size: 0.82rem; }

.pt-vf-note { font-size: 0.85rem; color: var(--pt-muted); line-height: 1.5; }

.pt-vt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.pt-chip-warn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--pt-warn);
  border: 1px solid var(--pt-warn-line);
  color: var(--pt-warn-ink);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.pt-chip-warn > span:first-child {
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--pt-warn-ink);
  color: var(--pt-warn);
  display: grid; place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.pt-extract, .pt-extract-edit {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.87rem;
  line-height: 1.62;
  color: var(--pt-body-ink);
  background: #fbfdfe;
  border: 1px solid var(--pt-line);
  border-radius: 12px;
  padding: 16px;
  max-height: 460px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pt-extract-edit { min-height: 320px; }

/* Highlight for the tokens that most change a report's meaning. Not a confidence
   score — see the legend copy and patient.js. Underline as well as colour so the
   cue survives colour-blindness and greyscale printing. */
.pt-extract mark {
  background: #fdf0c8;
  color: #6a4c05;
  border-radius: 3px;
  padding: 0 3px;
  text-decoration: underline;
  text-decoration-color: #d9ab3a;
  text-underline-offset: 2px;
}

.pt-vt-legend {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--pt-muted);
  line-height: 1.5;
}
.pt-legend-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  background: #fdf0c8;
  border: 1px solid var(--pt-warn-line);
  flex: none;
  margin-top: 3px;
}

.pt-vt-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}
@media (max-width: 560px) { .pt-vt-actions { grid-template-columns: 1fr; } }

.pt-back {
  display: inline-block;
  margin-top: 16px;
  background: none;
  border: 0;
  font: inherit;
  font-size: 0.92rem;
  color: var(--pt-muted);
  cursor: pointer;
  padding: 8px 4px;
}
.pt-back:hover { color: var(--pt-accent); }
.pt-back-center { display: block; margin: 26px auto 0; }

/* ---------------------------------------------------------------- results */

.pt-results-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.pt-results-top .pt-display { margin-bottom: 10px; text-align: left; }

.pt-controls { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pt-control { display: flex; flex-direction: column; gap: 7px; }
.pt-control-label { font-size: 0.85rem; color: var(--pt-muted); font-weight: 500; }

.pt-segmented {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--pt-line);
  border-radius: 12px;
  padding: 4px;
  gap: 2px;
}
.pt-segmented button {
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.92rem;
  color: var(--pt-muted);
  padding: 9px 16px;
  min-height: 42px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
}
.pt-segmented button.is-on {
  background: var(--pt-accent-soft);
  color: var(--pt-ink);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--teal-tint-line, rgba(26,127,150,0.22));
}
.pt-select { min-height: 42px; padding: 9px 12px; }

.pt-results {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 980px) {
  .pt-results { grid-template-columns: 1fr; }
  /* Explanation first on small screens — it is what the patient came for. */
  .pt-explain { order: -1; }
}

.pt-source { padding: clamp(16px, 2.4vw, 24px); position: sticky; top: 92px; }
@media (max-width: 980px) { .pt-source { position: static; } }

.pt-source-title {
  font-family: var(--pt-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--pt-ink);
  margin-bottom: 16px;
}
.pt-source-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--pt-line-soft);
  flex-wrap: wrap;
}
.pt-source-head > div { flex: 1; min-width: 0; }
.pt-source-head strong { display: block; color: var(--pt-ink); overflow-wrap: anywhere; }
.pt-source-head small { color: var(--pt-muted); font-size: 0.84rem; }
.pt-pill-ok {
  background: var(--pt-ok);
  color: var(--pt-ok-ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}
.pt-src-eyebrow { margin-top: 18px; margin-bottom: 10px; }

.pt-quote {
  position: relative;
  font-size: 0.94rem;
  line-height: 1.68;
  color: var(--pt-body-ink);
  padding: 4px 0 0 2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 260px;
  overflow-y: auto;
}
.pt-quote.is-full { max-height: none; }
.pt-quote p + p { margin-top: 10px; }

.pt-source-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 13px;
  background: #f5f9fb;
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--pt-muted);
  line-height: 1.5;
}

/* ---- explanation sections ---- */

.pt-explain { display: flex; flex-direction: column; gap: 14px; }

.pt-sec {
  background: #fff;
  border: 1px solid var(--pt-line);
  border-radius: 18px;
  padding: clamp(16px, 2.4vw, 24px);
  box-shadow: var(--pt-shadow);
}
.pt-sec-brief { background: linear-gradient(135deg, #f2fafc, #ffffff 60%); }

.pt-sec-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.pt-sec-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--pt-ink);
  color: #fff;
  display: grid; place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex: none;
}
.pt-sec-title { font-size: 1.06rem; font-weight: 700; color: var(--pt-ink); }

.pt-brief-text { font-size: 1.02rem; line-height: 1.68; color: var(--pt-body-ink); }
.pt-brief-text p + p { margin-top: 12px; }

/* finding cards */
.pt-finding {
  border: 1px solid var(--pt-line);
  border-radius: 14px;
  padding: 15px;
  background: #fff;
}
.pt-finding + .pt-finding { margin-top: 11px; }
.pt-finding-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 7px; }
.pt-finding-name { font-weight: 700; color: var(--pt-ink); font-size: 0.99rem; }
.pt-tag {
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 0.79rem;
  font-weight: 600;
  background: var(--pt-accent-soft);
  color: var(--pt-accent);
  border: 1px solid var(--teal-tint-line, rgba(26,127,150,0.22));
}
.pt-finding-body { font-size: 0.94rem; line-height: 1.62; color: var(--pt-body-ink); }
.pt-finding-detail {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--pt-muted);
  background: #f5f9fb;
  border-radius: 8px;
  padding: 5px 10px;
}

/* "The report says…" — source grounding, collapsed by default */
.pt-source-line { margin-top: 10px; }
.pt-source-line summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--pt-accent);
  list-style: none;
  padding: 5px 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pt-source-line summary::-webkit-details-marker { display: none; }
.pt-source-line summary::before { content: "“"; font-size: 1.2rem; line-height: 0.6; }
.pt-source-line[open] summary { margin-bottom: 6px; }
.pt-source-quote {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--pt-body-ink);
  background: #f7fafc;
  border-left: 3px solid var(--pt-accent);
  border-radius: 0 8px 8px 0;
  padding: 10px 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* reassuring list */
.pt-reassure { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.pt-reassure li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.94rem; line-height: 1.55; }
.pt-reassure-tick {
  width: 21px; height: 21px;
  border-radius: 50%;
  background: var(--pt-ok);
  color: var(--pt-ok-ink);
  display: grid; place-items: center;
  flex: none;
  margin-top: 1px;
}
.pt-reassure-tick svg { width: 12px; height: 12px; }

/* two-up row for glossary + reassuring on wide screens */
.pt-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 820px) { .pt-duo { grid-template-columns: 1fr; } }

/* glossary */
.pt-terms { list-style: none; display: flex; flex-direction: column; gap: 11px; }
.pt-term { font-size: 0.93rem; line-height: 1.55; }
.pt-term strong { color: var(--pt-ink); }
.pt-term span { color: var(--pt-muted); }

/* actions / recommended */
.pt-actions { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.pt-actions li {
  display: flex;
  gap: 10px;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 12px 14px;
  background: #f5f9fb;
  border-radius: 11px;
}
.pt-actions .pt-sec-num { width: 22px; height: 22px; font-size: 0.75rem; }

/* questions */
.pt-questions { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 11px; }
.pt-question {
  display: flex;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--pt-line);
  border-radius: 13px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--pt-body-ink);
  background: #fff;
}
.pt-q-icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--pt-accent-soft);
  color: var(--pt-accent);
  display: grid; place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex: none;
}

/* an honest empty/uncertain state */
.pt-note {
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--pt-warn);
  border: 1px solid var(--pt-warn-line);
  color: var(--pt-warn-ink);
  font-size: 0.92rem;
  line-height: 1.55;
}
.pt-empty { font-size: 0.93rem; color: var(--pt-muted); line-height: 1.55; }

/* loading */
.pt-loading { display: flex; flex-direction: column; gap: 14px; }
.pt-skel {
  background: linear-gradient(90deg, #eef3f6 25%, #f7fafc 50%, #eef3f6 75%);
  background-size: 200% 100%;
  animation: pt-shimmer 1.3s linear infinite;
  border-radius: 14px;
}
@keyframes pt-shimmer { to { background-position: -200% 0; } }
.pt-skel-lg { height: 128px; }
.pt-skel-md { height: 96px; }
.pt-status {
  text-align: center;
  color: var(--pt-muted);
  font-size: 0.94rem;
  padding: 6px;
}

/* ---------------------------------------------------------------- safety + modal */

.pt-safety {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  max-width: 900px;
  margin: clamp(30px, 5vw, 52px) auto 0;
  padding: 15px 18px;
  background: #fff;
  border: 1px solid var(--pt-line);
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--pt-muted);
}
.pt-safety strong { color: var(--pt-ink); display: block; }
.pt-safety-icon {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--pt-accent-soft);
  color: var(--pt-accent);
  display: grid; place-items: center;
  flex: none;
}
.pt-safety-icon svg { width: 17px; height: 17px; }

.pt-modal {
  position: fixed;
  inset: 0;
  background: rgba(14, 42, 71, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.pt-modal-card {
  background: #fff;
  border-radius: 18px;
  padding: clamp(20px, 4vw, 30px);
  max-width: 560px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--pt-shadow-lift);
}
.pt-modal-card h2 {
  font-family: var(--pt-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--pt-ink);
  margin-bottom: 16px;
}
.pt-modal-list { list-style: none; display: flex; flex-direction: column; gap: 13px; margin-bottom: 22px; }
.pt-modal-list li { font-size: 0.93rem; line-height: 1.6; color: var(--pt-body-ink); }
.pt-modal-list strong { color: var(--pt-ink); }
.pt-modal-warn {
  padding: 13px;
  background: var(--pt-warn);
  border: 1px solid var(--pt-warn-line);
  border-radius: 11px;
  color: var(--pt-warn-ink) !important;
}
.pt-modal-warn strong { color: var(--pt-warn-ink) !important; }
.pt-modal-close { width: 100%; }

/* ---------------------------------------------------------------- footer */

.pt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 1180px;
  margin: 40px auto 0;
  padding: 22px clamp(16px, 4vw, 32px) 34px;
  border-top: 1px solid var(--pt-line);
  color: var(--pt-muted);
  font-size: 0.88rem;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- RTL */

.pt-body[dir="rtl"] .pt-btn-text,
.pt-body[dir="rtl"] .pt-route-text { text-align: right; }
.pt-body[dir="rtl"] .pt-source-quote {
  border-left: 0;
  border-right: 3px solid var(--pt-accent);
  border-radius: 8px 0 0 8px;
}
.pt-body[dir="rtl"] .pt-results-top .pt-display { text-align: right; }
