/* ============================================================
   طبت — patient portal («بوابة المريض الآمنة»), T5-C (ADR-0150).
   Ported VERBATIM from the reference design
   (handoff/02-workspaces/patient-portal.html <style> block); the
   :root here resolves the design tokens (00-foundation/tokens.css)
   to their literal values so the sheet is self-contained. Only the
   demo JavaScript is replaced — by real server-rendered Blade. All
   PHI is emitted through escaped Blade, never into JavaScript.
   ============================================================ */
:root {
  --tebt-blue: #0038B2; --tebt-blue-700: #002B8A; --tebt-blue-500: #0038B2;
  --tebt-blue-400: #2B5BC9; --tebt-blue-300: #7E96D3; --tebt-blue-200: #B8C6E8;
  --tebt-blue-100: #E1E7F5; --tebt-blue-50: #F1F4FB;
  --ink: #14161C; --ink-2: #1F222B; --slate-700: #3C404E; --slate-600: #4B5063;
  --slate: #5A6072; --slate-400: #8A90A0; --mist: #D8DAE2; --cloud: #ECEDF1;
  --paper-2: #FAFAF8; --paper: #F6F6F4;
  --bg-page: var(--paper-2); --border-subtle: var(--cloud); --border-strong: var(--mist);
  --text-primary: var(--ink); --text-secondary: var(--slate); --text-muted: var(--slate-400);
  --success: #1B7F4D; --success-bg: #E6F3EC; --info: var(--tebt-blue); --info-bg: var(--tebt-blue-50);
}

*{ box-sizing:border-box; }
body{ font-size:16px; margin:0; background:var(--bg-page,#F4F5F7); color:var(--text-primary,#16181F); font-family:"IBM Plex Sans Arabic",sans-serif; -webkit-font-smoothing:antialiased; min-height:100vh; }
.en{ font-family:"IBM Plex Sans",sans-serif; } .mono{ font-family:"IBM Plex Mono",monospace; }
.pp-wrap{ max-width:520px; margin:0 auto; padding:0 16px 60px; }
.pp-bar{ display:flex; align-items:center; gap:10px; padding:16px 4px; }
.pp-logo{ width:34px; height:34px; border-radius:9px; background:var(--tebt-blue,#0038B2); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:16px; }
.pp-brand .n{ font-size:14px; font-weight:700; } .pp-brand .s{ font-size:14px; color:var(--text-muted,#6A7085); }
.pp-secure{ margin-inline-start:auto; display:inline-flex; align-items:center; gap:5px; font-size:14px; font-weight:600; color:#1F8A5B; background:#E4F5EC; padding:4px 10px; border-radius:999px; }
.pp-card{ background:#fff; border:1px solid var(--border-subtle,#E8EAED); border-radius:16px; padding:20px; margin-top:14px; box-shadow:0 1px 3px rgba(16,24,40,.04); }

/* gate */
.pp-gate .h{ font-size:18px; font-weight:700; } .pp-gate .d{ font-size:14px; color:var(--text-muted,#6A7085); margin-top:6px; line-height:1.7; }
.pp-otp{ display:flex; gap:8px; justify-content:center; margin:20px 0 6px; direction:ltr; }
.pp-otp input{ width:46px; height:54px; border:1.5px solid var(--border-strong,#CDD2D9); border-radius:12px; text-align:center; font-family:"IBM Plex Sans"; font-size:22px; font-weight:700; }
.pp-otp input:focus{ border-color:var(--tebt-blue,#0038B2); outline:none; }
/* single-box OTP variant (server-rendered, SMS one-time-code autofill) */
.pp-otp-one{ width:100%; max-width:260px; margin:20px auto 6px; display:block; height:56px; border:1.5px solid var(--border-strong,#CDD2D9); border-radius:12px; text-align:center; font-family:"IBM Plex Sans"; font-size:26px; font-weight:700; letter-spacing:12px; direction:ltr; }
.pp-otp-one:focus{ border-color:var(--tebt-blue,#0038B2); outline:none; }
.pp-phone-field{ margin:18px 0 6px; }
.pp-phone-field label{ display:block; font-size:14px; font-weight:700; color:var(--text-secondary); margin-bottom:8px; }
.pp-phone-input{ width:100%; height:52px; border:1.5px solid var(--border-strong,#CDD2D9); border-radius:12px; padding:0 15px; font-family:"IBM Plex Sans"; font-size:16px; font-weight:600; direction:ltr; text-align:start; }
.pp-phone-input:focus{ border-color:var(--tebt-blue,#0038B2); outline:none; }
.pp-hint{ font-size:16px; color:var(--text-muted); text-align:center; }
.pp-err-box{ font-size:14px; color:#B23131; background:#FBE9E9; border-radius:10px; padding:10px 13px; margin-top:14px; text-align:center; }
.pp-btn{ width:100%; min-height:48px; border:0; border-radius:12px; background:var(--tebt-blue,#0038B2); color:#fff; font-family:inherit; font-size:16px; font-weight:600; cursor:pointer; margin-top:16px; }
.pp-btn:disabled{ opacity:.5; cursor:not-allowed; }

/* patient card */
.pp-pt-card{ display:flex; align-items:center; gap:12px; }
.pp-av{ width:46px; height:46px; border-radius:50%; background:var(--tebt-blue-400,#2B5BC9); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; flex-shrink:0; }
.pp-pt-card .nm{ font-size:15px; font-weight:700; } .pp-pt-card .mt{ font-size:14px; color:var(--text-muted); margin-top:2px; }
.pp-logout{ min-width:44px; min-height:44px; font-family:inherit; margin-inline-start:auto; font-size:14px; font-weight:600; color:var(--text-muted); background:var(--bg-page); border:1px solid var(--border-subtle); border-radius:9px; padding:7px 11px; cursor:pointer; }

/* tab strip */
.pp-tabs{ display:flex; gap:6px; overflow-x:auto; padding:12px 0 4px; margin:0; scrollbar-width:none; position:sticky; top:0; background:var(--bg-page,#F4F5F7); z-index:5; }
.pp-tabs::-webkit-scrollbar{ display:none; }
.pp-tab{ min-width:44px; min-height:44px; flex:0 0 auto; padding:9px 15px; border-radius:999px; border:1px solid var(--border-subtle,#E8EAED); background:#fff; font-family:inherit; font-size:14px; font-weight:600; color:var(--text-secondary,#444B5A); cursor:pointer; white-space:nowrap; display:inline-flex; align-items:center; gap:6px; text-decoration:none; }
.pp-tab svg{ width:15px; height:15px; }
.pp-tab.active{ background:var(--tebt-blue,#0038B2); color:#fff; border-color:var(--tebt-blue,#0038B2); }
.pp-tab .badge{ font-size:14px; font-weight:800; background:#B23131; color:#fff; border-radius:999px; padding:0 6px; min-width:16px; min-height:21px; display:inline-flex; align-items:center; justify-content:center; }

/* sections + lists */
.pp-sec-h{ font-size:14px; font-weight:700; color:var(--text-muted); margin:18px 4px 9px; }
.pp-sec-h:first-child{ margin-top:14px; }
.pp-list{ display:flex; flex-direction:column; gap:10px; }
.pp-item{ background:#fff; border:1px solid var(--border-subtle,#E8EAED); border-radius:14px; padding:14px 15px; box-shadow:0 1px 2px rgba(16,24,40,.03); }
.pp-item-top{ display:flex; align-items:center; gap:11px; }
.pp-item.acc .pp-item-top{ cursor:pointer; }
.pp-item-ic{ width:38px; height:38px; border-radius:10px; background:var(--tebt-blue-50,#EAF0FB); color:var(--tebt-blue,#0038B2); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.pp-item-ic svg{ width:18px; height:18px; }
.pp-item-ic.green{ background:#E4F5EC; color:#1F8A5B; } .pp-item-ic.amber{ background:#FBF6E3; color:#8A6D12; } .pp-item-ic.red{ background:#FBE9E9; color:#B23131; }
.pp-item-tx{ min-width:0; flex:1; }
.pp-item-tx .t{ font-size:14px; font-weight:700; overflow-wrap:anywhere; }
.pp-item-tx .s{ font-size:14px; color:var(--text-muted); margin-top:3px; line-height:1.5; }
.pp-pill{ font-size:14px; font-weight:700; padding:3px 9px; border-radius:999px; flex-shrink:0; white-space:nowrap; }
.pp-pill.ok{ background:#E4F5EC; color:#1F8A5B; } .pp-pill.warn{ background:#FBF6E3; color:#8A6D12; }
.pp-pill.due{ background:#FBE9E9; color:#B23131; } .pp-pill.muted{ background:var(--bg-page,#F4F5F7); color:var(--text-muted); }
.pp-chev{ width:18px; height:18px; color:var(--text-muted); flex-shrink:0; transition:transform .2s; }
.pp-item.open .pp-chev{ transform:rotate(180deg); }
.pp-item-detail{ margin-top:13px; padding-top:13px; border-top:1px dashed var(--border-subtle,#E8EAED); display:none; }
.pp-item.open .pp-item-detail{ display:block; }
.pp-row{ display:flex; justify-content:space-between; font-size:14px; padding:6px 0; border-bottom:1px dashed var(--border-subtle,#E8EAED); }
.pp-row:last-child{ border-bottom:0; }
.pp-row .v{ font-family:"IBM Plex Sans"; font-weight:600; display:inline-flex; align-items:center; gap:6px; }
.pp-flag{ font-size:14px; font-weight:700; padding:1px 7px; border-radius:999px; }
.pp-flag.normal{ background:#E4F5EC; color:#1F8A5B; } .pp-flag.high{ background:#FBF6E3; color:#8A6D12; } .pp-flag.low{ background:#EAF0FB; color:#0038B2; } .pp-flag.crit{ background:#FBE9E9; color:#B23131; }
.pp-note{ font-size:14px; color:var(--text-muted); line-height:1.7; background:var(--bg-page,#F8F9FB); border-radius:10px; padding:11px 13px; margin-top:12px; }
.pp-ok{ font-size:14px; color:var(--success,#1B7F4D); background:var(--success-bg,#E6F3EC); border-radius:10px; padding:10px 13px; margin-top:14px; text-align:center; }
.pp-field{ margin-top:13px; }
.pp-field label{ display:block; }
.pp-field label span{ display:block; font-size:14px; font-weight:600; color:var(--text-secondary,#5A6072); margin-bottom:6px; }
.pp-field input{ width:100%; height:48px; border:1px solid var(--border-strong,#CDD2D9); border-radius:10px; padding:0 12px; font-family:inherit; font-size:16px; color:var(--text-primary); background:#fff; }
.pp-field input:focus{ outline:none; border-color:var(--tebt-blue,#0038B2); }
.pp-act-row{ display:flex; gap:8px; margin-top:13px; }
.pp-appt-actions{ display:flex; gap:8px; padding-top:4px; }
.pp-mini{ flex:1; height:38px; border-radius:9px; border:1px solid var(--border-strong,#CDD2D9); background:#fff; font-family:inherit; font-size:12.5px; font-weight:600; color:var(--text-secondary); cursor:pointer; }
.pp-mini:hover{ background:var(--bg-page,#F4F5F7); }
.pp-mini.danger{ color:#B23131; border-color:#F0CCCC; }
.pp-mini.danger:hover{ background:#FBE9E9; }
.pp-act{ min-width:44px; min-height:44px; flex:1; border-radius:10px; border:1px solid var(--border-strong,#CDD2D9); background:#fff; font-family:inherit; font-size:16px; font-weight:600; color:var(--text-primary); cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px; text-decoration:none; }
.pp-act svg{ width:15px; height:15px; }
.pp-act.primary{ min-height:48px; background:var(--tebt-blue,#0038B2); color:#fff; border-color:var(--tebt-blue,#0038B2); }
.pp-empty{ text-align:center; color:var(--text-muted); font-size:14px; padding:34px 14px; line-height:1.7; }
.pp-empty svg{ width:34px; height:34px; color:var(--border-strong,#CDD2D9); margin-bottom:10px; }

/* overview summary */
.pp-sum{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:4px; }
.pp-sum-card{ background:#fff; border:1px solid var(--border-subtle,#E8EAED); border-radius:14px; padding:14px; cursor:pointer; text-align:start; box-shadow:0 1px 2px rgba(16,24,40,.03); text-decoration:none; color:inherit; display:block; }
.pp-sum-card .k{ font-size:14px; color:var(--text-muted); display:flex; align-items:center; gap:6px; }
.pp-sum-card .k svg{ width:14px; height:14px; }
.pp-sum-card .v{ font-size:15px; font-weight:700; margin-top:9px; }
.pp-sum-card .vs{ font-size:14px; color:var(--text-muted); margin-top:2px; }
.pp-quick{ display:flex; gap:8px; margin-top:12px; }
.pp-act-lg{ min-height:50px; font-size:16px; border-radius:12px; }
.pp-act-lg svg{ width:18px; height:18px; }

.pp-foot{ text-align:center; font-size:14px; color:var(--text-muted); margin-top:24px; line-height:1.7; }

/* Keyboard disclosures and phone actions. */
button.pp-item-top{ width:100%; min-height:44px; padding:0; border:0; background:transparent; color:inherit; font:inherit; text-align:start; }
.pp-item-tx .t,.pp-item-tx .s{ display:block; }
.pp-instructions{ font-size:14px; color:var(--text-muted); margin:-2px 0 8px; line-height:1.5; }
.pp-gate button[formaction]{ min-width:44px; min-height:44px; display:inline-flex; align-items:center; justify-content:center; }
.pp-wrap :is(a,button,input,select,textarea,summary):focus-visible{ outline:2px solid var(--tebt-blue); outline-offset:3px; }
.pp-has-bottom-nav .pp-wrap{ padding-bottom:calc(96px + env(safe-area-inset-bottom)); }
.pp-bottom-nav{ position:fixed; inset-inline:0; bottom:0; max-width:520px; margin-inline:auto; display:flex; min-height:56px; padding:0 8px env(safe-area-inset-bottom); background:#fff; border-top:1px solid var(--border-subtle); z-index:10; }
.pp-bottom-link{ flex:1; min-width:44px; min-height:56px; padding:6px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; color:var(--text-secondary); font-size:14px; text-decoration:none; }
.pp-bottom-link svg{ width:20px; height:20px; }
.pp-bottom-link[aria-current="page"]{ color:var(--tebt-blue); font-weight:700; }
@media (min-width:1024px){ .pp-bottom-nav{ display:none; } .pp-has-bottom-nav .pp-wrap{ padding-bottom:60px; } }

/* QA visual responsive audit */
@media(max-width:600px) {
 .pp-item-top:has([data-testid="portal-lab-held"]) { flex-wrap:wrap; }
 .pp-item-top:has([data-testid="portal-lab-held"]) .pp-item-tx { flex:1 1 calc(100% - 64px); }
 [data-testid="portal-lab-held"] { white-space:normal; max-width:100%; line-height:1.6; }
}
