/* ===========================================================
   Medicross — Client Portal (dashboard)
   Design tokens shared with the marketing site (assets/home.css)
   =========================================================== */
:root {
  --brand: #D42B2B;
  --brand-dark: color-mix(in srgb, var(--brand) 82%, #000);
  --brand-deep: color-mix(in srgb, var(--brand) 66%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 76%, #fff);
  --accent: #2E6BF0;
  --ink: #211E1A;
  --muted: #6B655C;
  --cream: #FBF7F1;
  --line: rgba(33, 30, 26, .1);
  --card: #FFFFFF;
  --chip: #F3EEE7;
  --ring-track: #e7e1d8;
  --success: #3c8a52;
  --success-bg: #eef3ee;
  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Manrope', system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.portal {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 0;
}
body.portal img, body.portal svg { max-width: 100%; display: block; }
body.portal a { color: inherit; text-decoration: none; }
body.portal button { font-family: inherit; }
.pwrap { max-width: 1280px; margin: 0 auto; padding: 0 30px; }

/* ===================== HEADER ===================== */
.ph {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,247,241,.9); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.ph-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 13px 30px; max-width: 1280px; margin: 0 auto; }
.ph-left { display: flex; align-items: center; gap: 34px; }
.ph-logo { display: block; flex: none; }
.ph-logo img { height: 32px; width: auto; display: block; }
.ph-nav { display: flex; gap: 24px; font-weight: 600; font-size: 14px; color: #4a453d; }
.ph-nav a { transition: color .2s ease; }
.ph-nav a:hover { color: var(--brand); }
.ph-nav a.active { color: var(--brand); }
.ph-right { display: flex; align-items: center; gap: 14px; }
.ph-bell { position: relative; color: #4a453d; display: inline-flex; }
.ph-bell .dotred { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); border: 2px solid var(--cream); }
.ph-user { display: flex; align-items: center; gap: 9px; padding: 5px 6px 5px 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.ph-user-txt { text-align: right; line-height: 1.15; }
.ph-user-txt .name { font-weight: 700; font-size: 12.5px; }
.ph-user-txt .role { font-size: 10.5px; color: var(--muted); }
.ph-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.ph-back { font-size: 13px; font-weight: 700; color: var(--muted); }
.ph-back:hover { color: var(--brand); }
.ph-logout {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 700; font-size: 13px; padding: 9px 16px;
  border-radius: 999px; cursor: pointer; transition: border-color .2s, color .2s;
}
.ph-logout:hover { border-color: var(--brand); color: var(--brand); }

/* ===================== LAYOUT ===================== */
.pmain { padding: 26px 30px 100px; max-width: 1280px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; }

/* general description written by the Medicross team */
.details-card { padding: 20px 24px 22px; margin-bottom: 18px; }
.details-card h2 { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin-bottom: 10px; }
.details-text { font-size: 14px; line-height: 1.75; color: #40392f; white-space: pre-line; }

/* partner hospital on a trip stage */
.tnode .hosp {
  font-size: 10.5px; font-weight: 700; color: var(--brand-dark);
  margin-top: 4px; line-height: 1.4;
}

/* empty states (a brand-new account has no operations / trip yet) */
.empty-note {
  padding: 16px 18px; border: 1px dashed var(--line); border-radius: 14px;
  font-size: 13px; color: var(--muted); line-height: 1.6; width: 100%;
}
.timeline:has(.empty-note)::before { display: none; }

/* admin-viewing-patient-portal notice */
.admin-view-note {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 12px 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 9%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  color: #24408c; font-size: 13px; font-weight: 600;
}
.admin-view-note a { color: var(--accent); text-decoration: underline; font-weight: 700; }
.a-consent input:disabled { opacity: .5; }
.a-consent:has(input:disabled) { cursor: default; }

/* welcome */
.welcome { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.welcome .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-dark); margin-bottom: 8px; display: block; }
.welcome h1 { font-family: var(--font-display); font-weight: 600; font-size: 40px; letter-spacing: -.02em; }
.next-card { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-radius: 16px; }
.next-ic { width: 40px; height: 40px; border-radius: 11px; background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); display: grid; place-items: center; flex: none; }
.next-txt { line-height: 1.25; }
.next-txt .lbl { font-size: 11px; color: var(--muted); }
.next-txt .val { font-weight: 700; font-size: 14px; }
.next-txt .val .cnt { color: var(--brand); }

/* row: body map + operations */
.row-2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 0; }
.card-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 20px; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.seg { display: flex; background: var(--chip); border-radius: 11px; padding: 3px; flex: none; }
.seg button { border: none; background: transparent; color: var(--muted); font-weight: 700; font-size: 13.5px; padding: 11px 17px; border-radius: 10px; cursor: pointer; transition: background .2s ease, color .2s ease; }
.seg button.active { background: var(--brand); color: #fff; }

.bodymap-frame { position: relative; height: 360px; margin: 6px 6px 0; border-radius: 16px; overflow: hidden; background: radial-gradient(120% 90% at 50% 20%, #fbf9f5, #efe9e0); }
.bodymap-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.opchips { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px 18px; }
.opchip {
  cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-weight: 700; font-size: 13.5px; padding: 11px 18px; border-radius: 999px;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.opchip.active { background: var(--brand); color: #fff; border-color: transparent; }

/* operations list */
.oplist { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.oprow { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; transition: border-color .2s, background .2s; }
.oprow.active-row { border-color: color-mix(in srgb, var(--brand) 30%, transparent); background: color-mix(in srgb, var(--brand) 5%, #fff); }
.oprow.done-row { opacity: .85; }
.op-idx { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; background: var(--chip); color: var(--muted); }
.oprow.active-row .op-idx { background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand-dark); }
.op-idx.done { background: var(--success-bg); color: var(--success); }
.op-body { flex: 1; min-width: 0; }
.op-body .t { font-weight: 700; font-size: 14.5px; }
.op-body .d { font-size: 12px; color: var(--muted); }
.op-meta { text-align: right; flex: none; }
.op-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; }
.op-pill.programata { color: var(--brand-dark); background: color-mix(in srgb, var(--brand) 12%, #fff); }
.op-pill.evaluare { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, #fff); }
.op-pill.finalizata { color: var(--success); background: var(--success-bg); }
.op-date { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* schedule */
.schedule-card { padding: 20px 24px 24px; margin-bottom: 18px; }
.schedule-card h2 { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin-bottom: 4px; }
.schedule-card .sub { font-size: 12px; color: var(--muted); margin-bottom: 22px; }
.timeline { position: relative; display: flex; justify-content: space-between; gap: 8px; }
.timeline::before { content: ""; position: absolute; left: 18px; right: 18px; top: 18px; border-top: 2px dashed color-mix(in srgb, var(--brand) 40%, transparent); }
.tnode { position: relative; flex: 1; text-align: center; }
.tnode .dot { display: inline-flex; width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); color: var(--brand); align-items: center; justify-content: center; }
.tnode.surgery .dot { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--brand) 60%, transparent); }
.tnode .date { font-weight: 700; font-size: 12.5px; margin-top: 11px; }
.tnode .desc { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.tnode.surgery .date { color: var(--brand); }

/* discounts */
.row-2b { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; }
.disc-card { padding: 20px 24px 24px; }
.disc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.disc-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 20px; }
.disc-head .sub { font-size: 12px; color: var(--muted); max-width: 340px; margin-top: 4px; }
.ring-wrap { position: relative; width: 96px; height: 96px; flex: none; }
.ring { width: 96px; height: 96px; border-radius: 50%; background: conic-gradient(var(--brand) 0deg, var(--ring-track) 0deg); transition: background .5s ease; }
.ring-inner { position: absolute; inset: 8px; background: #fff; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-family: var(--font-display); font-weight: 600; font-size: 28px; color: var(--brand); line-height: 1; }
.ring-lbl { font-size: 9px; color: var(--muted); letter-spacing: .08em; }

.actions { display: flex; flex-direction: column; gap: 10px; }
.arow { display: flex; align-items: flex-start; gap: 13px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; transition: border-color .25s ease, background .25s ease; }
.arow.earned { border-color: color-mix(in srgb, var(--brand) 35%, transparent); background: color-mix(in srgb, var(--brand) 4%, #fff); }
.a-ic { width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--chip); display: grid; place-items: center; color: #4a453d; margin-top: 1px; }
.a-body { flex: 1; min-width: 0; }
.a-body .t { font-weight: 700; font-size: 13.5px; }
.a-body .t .pct { color: var(--brand); white-space: nowrap; }
.a-body .status { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.a-consent { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.a-consent input { width: 15px; height: 15px; accent-color: var(--brand); }
.a-btn { border: none; cursor: pointer; font-weight: 700; font-size: 13.5px; padding: 12px 20px; border-radius: 10px; background: var(--brand); color: #fff; flex: none; transition: background .2s, color .2s; white-space: nowrap; }
.a-btn.earned-btn { background: var(--success-bg); color: var(--success); }
.a-link { align-self: center; font-size: 12px; font-weight: 700; color: var(--muted); flex: none; white-space: nowrap; }
.a-link:hover { color: var(--brand); }
.a-link[hidden] { display: none; }
.a-btn.outline-btn { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.disc-note { margin-top: 13px; font-size: 11.5px; line-height: 1.6; color: var(--muted); }

/* docs + referral */
.side-col { display: flex; flex-direction: column; gap: 18px; }
.docs-card { padding: 18px 20px 20px; }
.docs-card h2 { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin-bottom: 14px; }
.doclist { display: flex; flex-direction: column; gap: 8px; }
.doc-row { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; transition: transform .25s ease, box-shadow .25s ease; }
.doc-row:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgba(33,30,26,.25); }
.doc-row .ic { color: var(--brand); flex: none; }
.doc-row > div:last-child { min-width: 0; }
.doc-row .t { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .m { font-size: 11px; color: var(--muted); }
.doc-drop {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.doc-drop.dragover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 4%, #fff); }
.doc-drop input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.doc-drop:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }

.referral-card { padding: 18px 20px 20px; background: linear-gradient(150deg, #211E1A, #3a332c); color: #fff; border: none; }
.referral-card h2 { font-family: var(--font-display); font-weight: 600; font-size: 19px; margin-bottom: 6px; }
.referral-card p { font-size: 12px; color: rgba(255,255,255,.65); margin-bottom: 14px; }
.ref-row { display: flex; gap: 8px; }
.ref-code { flex: 1; font-family: ui-monospace, Menlo, monospace; font-weight: 700; font-size: 14px; letter-spacing: .06em; padding: 12px 14px; background: rgba(255,255,255,.1); border-radius: 11px; border: 1px dashed rgba(255,255,255,.25); overflow-x: auto; white-space: nowrap; }
.ref-copy { border: none; cursor: pointer; font-weight: 700; font-size: 14.5px; padding: 0 24px; border-radius: 12px; background: var(--brand); color: #fff; transition: transform .25s ease; }
.ref-copy:hover { transform: translateY(-2px); }
.ref-copy.copied { background: var(--success); }

/* mobile bottom tab bar */
.ptabs { display: none; }

@media (max-width: 1024px) {
  .row-2, .row-2b { grid-template-columns: 1fr; }
  .ph-nav { display: none; }

  /* Stacked order matches the handoff's phone mockup: welcome → body map →
     discounts → operations (schedule + docs/referral follow, not covered
     by the mockup). .row-2/.row-2b drop their box so their children can be
     reordered as direct flex items of .pmain. */
  .pmain { display: flex; flex-direction: column; }
  .row-2, .row-2b { display: contents; }
  .welcome { order: 1; }
  .bodymap-card { order: 2; margin-bottom: 18px; }
  .disc-card { order: 3; margin-bottom: 18px; }
  #operatii { order: 4; margin-bottom: 18px; }
  .schedule-card { order: 5; }
  .side-col { order: 6; }
}
@media (max-width: 720px) {
  .pwrap, .pmain { padding-left: 18px; padding-right: 18px; }
  .ph-inner { padding: 13px 18px; }
  .ph-left { gap: 14px; }
  .ph-back, .ph-bell { display: none; }
  .ph-logo img { height: 26px; }
  .welcome h1 { font-size: 32px; }
  .card-head { flex-wrap: wrap; gap: 12px; }
  .seg button { padding: 9px 13px; font-size: 12.5px; }
  .disc-head { flex-direction: row; }
  .disc-head .sub { display: none; }
  .timeline { flex-direction: column; align-items: stretch; gap: 18px; }
  .timeline::before { left: 18px; top: 18px; bottom: 18px; right: auto; width: 0; border-top: none; border-left: 2px dashed color-mix(in srgb, var(--brand) 40%, transparent); }
  .tnode { display: flex; align-items: flex-start; gap: 14px; text-align: left; }
  .tnode .date { margin-top: 0; }
  .pmain { padding-bottom: 90px; }
  .ptabs {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    justify-content: space-around; padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
    background: rgba(251,247,241,.94); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  }
  .ptabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 10px; font-weight: 700; }
  .ptabs a.active { color: var(--brand); }
  .ph-user-txt { display: none; }
  .ph-user { padding: 4px; background: transparent; border: none; }
}

/* Medical disclaimer. The portal shows a treatment plan written by our team,
   so the notice sits at the end of the dashboard rather than in a footer the
   portal does not have. Extra bottom padding clears the mobile tab bar. */
.portal-disclaimer {
  margin: 40px 0 0; padding: 22px 0 0;
  border-top: 1px solid var(--line);
  font-size: 12.5px; line-height: 1.75; color: var(--muted);
  max-width: 105ch;
}
.portal-disclaimer p { margin: 0 0 11px; }
.portal-disclaimer strong { color: var(--ink); font-weight: 700; }
.portal-disclaimer-links { margin-top: 14px; }
.portal-disclaimer-links a { color: var(--brand); text-decoration: underline; }
@media (max-width: 720px) {
  .portal-disclaimer { padding-bottom: 84px; }
}

/* ===================== GDPR GATE =====================
   A mandatory overlay a patient cannot get past without ticking consent.
   z-index sits above the sticky header (50) and the mobile tab bar. There is
   no close affordance beyond the two buttons inside the card — no backdrop
   click handler, no Escape handler — by design. */
.gdpr-gate {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(33, 30, 26, .55);
  backdrop-filter: blur(3px);
}
/* The class above sets its own `display`, which otherwise wins the cascade
   over the UA stylesheet's `[hidden] { display: none }` — without this rule
   the gate stays visible even while the `hidden` attribute is set. */
.gdpr-gate[hidden] { display: none; }
.gdpr-gate-card {
  width: 100%; max-width: 460px;
  background: var(--card); border-radius: 20px;
  padding: 32px 30px 28px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.35);
}
.gdpr-gate-card h2 {
  font-family: var(--font-display); font-weight: 600; font-size: 23px;
  margin-bottom: 12px; letter-spacing: -.01em;
}
.gdpr-gate-card p { font-size: 14.5px; line-height: 1.6; color: var(--muted); margin-bottom: 20px; }
.gdpr-gate-check {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px;
  cursor: pointer; margin-bottom: 18px;
}
.gdpr-gate-check input {
  width: 19px; height: 19px; flex: none; margin-top: 1px; accent-color: var(--brand);
}
.gdpr-gate-check span { font-size: 13.5px; line-height: 1.55; }
.gdpr-gate-check a { color: var(--brand); text-decoration: underline; font-weight: 700; }
.gdpr-gate-btn {
  width: 100%; border: none; border-radius: 999px; padding: 14px;
  background: var(--brand); color: #fff; font: inherit; font-weight: 800; font-size: 14.5px;
  cursor: pointer; transition: opacity .2s, background .2s;
}
.gdpr-gate-btn:disabled { background: var(--ring-track); color: var(--muted); cursor: not-allowed; }
.gdpr-gate-btn:not(:disabled):hover { background: var(--brand-dark); }
.gdpr-gate-logout {
  display: block; width: 100%; margin-top: 14px; padding: 6px;
  border: none; background: none; font: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--muted); cursor: pointer; text-decoration: underline;
}
.gdpr-gate-logout:hover { color: var(--brand); }
@media (max-width: 480px) {
  .gdpr-gate-card { padding: 26px 22px 22px; }
}
