// tab-preauth.jsx — F3 Pre-auth submission + SLA tracking + response logging
// Includes the PDF "preview", mark-as-submitted flow, live SLA timer,
// escalation email generator, and approve/partial/deny response logging.

const PCPT_t = window.PCT;
const PCPT_d = window.PCA;

function PreAuthTab({ claim, insurer }) {
  const store = useStore();
  const s = claim.status;

  // Phase: 'ready', 'submitted', 'responded'
  let phase = 'ready';
  if (s === 'PREAUTH_SUBMITTED') phase = 'submitted';
  if (['PREAUTH_APPROVED','PREAUTH_PARTIAL','PREAUTH_DENIED','PREAUTH_QUERY','ACTIVE_STAY','CLAIM_READY','CLAIM_SUBMITTED','SETTLED'].includes(s)) phase = 'responded';
  if (s === 'DOCS_PENDING' || s === 'INTAKE') phase = 'blocked';

  return (
    <div style={{ display:'grid', gridTemplateColumns:'1fr 320px', gap:14 }}>
      <div style={{ display:'flex', flexDirection:'column', gap:14 }}>
        <PhaseStrip phase={phase}/>
        {phase === 'blocked'  && <BlockedCard claim={claim}/>}
        {phase === 'ready'    && <ReadyToSubmitCard claim={claim} insurer={insurer}/>}
        {phase === 'submitted'&& <SubmittedAwaitingCard claim={claim} insurer={insurer}/>}
        {phase === 'responded'&& <RespondedCard claim={claim} insurer={insurer}/>}
        <PDFPreviewCard claim={claim} insurer={insurer}/>
      </div>
      <div style={{ display:'flex', flexDirection:'column', gap:14 }}>
        <SubmissionInstructions insurer={insurer}/>
        <SLAReferenceCard/>
      </div>
    </div>
  );
}

function PhaseStrip({ phase }) {
  const phases = [
    { id:'ready',     label:'Ready'  },
    { id:'submitted', label:'Submitted to TPA' },
    { id:'responded', label:'Response logged' },
  ];
  const idx = phases.findIndex(p => p.id === phase);
  return (
    <div style={{
      display:'flex', alignItems:'center', gap:8,
      padding:'10px 14px',
      background: PCPT_t.c.surface,
      border: `1px solid ${PCPT_t.c.border}`,
      borderRadius:9,
    }}>
      {phases.map((p, i) => (
        <React.Fragment key={p.id}>
          <div style={{
            padding:'5px 12px', borderRadius:6,
            background: i === idx ? PCPT_t.c.brandSoft : i < idx ? PCPT_t.c.successTint : PCPT_t.c.surface2,
            color: i === idx ? PCPT_t.c.brand : i < idx ? PCPT_t.c.success : PCPT_t.c.textMuted,
            fontSize:12, fontWeight: i === idx ? 600 : 500,
            display:'flex', alignItems:'center', gap:6,
          }}>
            {i < idx && <AppIcon name="check" size={12}/>}
            {p.label}
          </div>
          {i < phases.length - 1 && <AppIcon name="right" size={12} color={PCPT_t.c.textDim}/>}
        </React.Fragment>
      ))}
      <div style={{ flex:1 }}/>
      <div style={{ fontSize:11, color: PCPT_t.c.textDim, fontFamily: PCPT_t.f.mono, letterSpacing:'.04em' }}>
        IRDAI · 1-hour SLA enforced
      </div>
    </div>
  );
}

function BlockedCard({ claim }) {
  return (
    <AppCard>
      <div style={{ display:'flex', gap:14, alignItems:'flex-start' }}>
        <div style={{
          width:36, height:36, borderRadius:8,
          background: PCPT_t.c.warningTint,
          color: PCPT_t.c.warning,
          display:'grid', placeItems:'center', flexShrink:0,
        }}>
          <AppIcon name="alert" size={18}/>
        </div>
        <div style={{ flex:1 }}>
          <div style={{ fontSize:15, fontWeight:600 }}>Documents incomplete</div>
          <div style={{ fontSize:12.5, color: PCPT_t.c.textMuted, marginTop:6, lineHeight:1.5 }}>
            The insurer's required documents must be uploaded (or overridden with a documented reason) before pre-auth can be generated.
          </div>
          <div style={{ marginTop:14 }}>
            <a href={`#/claims/${claim.id}/documents`} style={{ textDecoration:'none' }}>
              <AppBtn kind="primary" icon="right">Go to documents</AppBtn>
            </a>
          </div>
        </div>
      </div>
    </AppCard>
  );
}

function ReadyToSubmitCard({ claim, insurer }) {
  const store = useStore();

  const handleSubmit = () => {
    const now = Date.now();
    const slaMs = insurer.slaPreauthMin * 60 * 1000;
    store.updateClaim(claim.id, {
      status: 'PREAUTH_SUBMITTED',
      preauthSubmittedAt: now,
      slaDeadlineAt: now + slaMs,
    });
    store.fireNotificationForStatus({ ...claim, insurer: claim.insurer, patient: claim.patient }, 'PREAUTH_SUBMITTED', {});
  };

  return (
    <AppCard>
      <AppSectionLabel>Ready to submit</AppSectionLabel>
      <div style={{ marginTop:8, fontSize:15, fontWeight:600, color: PCPT_t.c.text }}>
        Pre-auth packet assembled for {insurer.name}
      </div>
      <div style={{ fontSize:12.5, color: PCPT_t.c.textMuted, marginTop:6, lineHeight:1.55 }}>
        <strong>{claim.documents.length} documents</strong> in TPA-specified sequence · ROHINI {PCPT_d.tenant.rohini} stamped ·
        Doctor reg <strong>{claim.doctorReg}</strong> verified · Estimate <strong>{PCPT_d.inr(claim.estimatedCost)}</strong>.
      </div>

      <div style={{
        marginTop:16, padding:'14px 16px',
        background: PCPT_t.c.surface2, borderRadius:8,
        display:'grid', gridTemplateColumns:'1fr auto', gap:14, alignItems:'center',
      }}>
        <div>
          <div style={{ fontSize:13, fontWeight:600, color: PCPT_t.c.text }}>Step 1 · Download packet</div>
          <div style={{ fontSize:11.5, color: PCPT_t.c.textMuted, marginTop:3 }}>4-page PDF, all docs assembled · 1.2 MB</div>
        </div>
        <AppBtn icon="download" kind="ghost">Download PDF</AppBtn>
      </div>

      <div style={{
        marginTop:8, padding:'14px 16px',
        background: PCPT_t.c.surface2, borderRadius:8,
        display:'grid', gridTemplateColumns:'1fr auto', gap:14, alignItems:'center',
      }}>
        <div>
          <div style={{ fontSize:13, fontWeight:600, color: PCPT_t.c.text }}>Step 2 · Upload to {insurer.name} portal</div>
          <div style={{ fontSize:11.5, color: PCPT_t.c.textMuted, marginTop:3 }}>
            <span style={{ fontFamily: PCPT_t.f.mono }}>{insurer.portal.replace(/https?:\/\/(www\.)?/,'')}</span>
            <span style={{ marginLeft:8, color: PCPT_t.c.textDim, fontStyle:'italic' }}>· manual upload, Phase 1</span>
          </div>
        </div>
        <AppBtn icon="right" kind="ghost">Open portal</AppBtn>
      </div>

      <div style={{
        marginTop:8, padding:'14px 16px',
        background: PCPT_t.c.brandSoft, borderRadius:8,
        display:'grid', gridTemplateColumns:'1fr auto', gap:14, alignItems:'center',
      }}>
        <div>
          <div style={{ fontSize:13, fontWeight:600, color: '#4C1D95' }}>Step 3 · Mark as submitted</div>
          <div style={{ fontSize:11.5, color:'#5B21B6', marginTop:3 }}>
            Starts the IRDAI 1-hour SLA countdown · fires WhatsApp to patient
          </div>
        </div>
        <AppBtn kind="brand" icon="send" onClick={handleSubmit}>Mark submitted</AppBtn>
      </div>
    </AppCard>
  );
}

function SubmittedAwaitingCard({ claim, insurer }) {
  const store = useStore();
  const [respModal, setRespModal] = React.useState(false);

  const handleSendEscalation = () => {
    store.toast({
      icon:'whatsapp',
      title:'Escalation email copied',
      body:`Sent to ${insurer.name} relationship manager (manually)`,
    });
  };

  return (
    <AppCard>
      <div style={{ display:'flex', justifyContent:'space-between', alignItems:'flex-start', gap:14 }}>
        <div style={{ flex:1 }}>
          <AppSectionLabel>Awaiting TPA response</AppSectionLabel>
          <div style={{ marginTop:8, fontSize:15, fontWeight:600 }}>
            Submitted to {insurer.name} at <span style={{ fontFamily: PCPT_t.f.mono, fontWeight:500 }}>{PCPT_d.dateLabel(claim.preauthSubmittedAt)}</span>
          </div>
          <div style={{ fontSize:12.5, color: PCPT_t.c.textMuted, marginTop:6, lineHeight:1.55 }}>
            IRDAI 1-hour SLA window is running. If no response by deadline, generate escalation email below.
          </div>
        </div>
        <div data-demo="clm-sla" style={{ flexShrink:0 }}>
          <AppSLATimer deadline={claim.slaDeadlineAt}/>
        </div>
      </div>

      {/* SLA breach banner */}
      {claim.slaDeadlineAt < Date.now() && (
        <div style={{
          marginTop:16, padding:'12px 14px',
          background: PCPT_t.c.errorTint, borderRadius:8,
          fontSize:12.5, color:'#991B1B', lineHeight:1.55,
          display:'flex', gap:10, alignItems:'flex-start',
        }}>
          <AppIcon name="alert" size={16} color={PCPT_t.c.error}/>
          <div style={{ flex:1 }}>
            <div style={{ fontWeight:600, marginBottom:4 }}>IRDAI SLA breached</div>
            <div>
              {insurer.name} has not responded within the 1-hour window. Generate the escalation email — it cites IRDAI guidelines and the submission timestamp.
            </div>
          </div>
          <AppBtn kind="danger" size="sm" icon="send" onClick={handleSendEscalation}>Send escalation</AppBtn>
        </div>
      )}

      <div style={{ marginTop:16, display:'flex', gap:8 }}>
        <AppBtn kind="primary" icon="check" onClick={() => setRespModal(true)}>Log TPA response</AppBtn>
        <AppBtn kind="ghost" icon="paperclip">Add query response</AppBtn>
      </div>

      <ResponseModal claim={claim} insurer={insurer} open={respModal} onClose={() => setRespModal(false)}/>
    </AppCard>
  );
}

function ResponseModal({ open, onClose, claim, insurer }) {
  const store = useStore();
  const [response, setResponse] = React.useState('APPROVED');
  const [approvedAmount, setApprovedAmount] = React.useState(claim.estimatedCost);
  const [refNumber, setRefNumber] = React.useState('');
  const [notes, setNotes] = React.useState('');

  const handleSubmit = () => {
    const patch = {};
    if (response === 'APPROVED') {
      patch.status = 'PREAUTH_APPROVED';
      patch.approvedAmount = claim.estimatedCost;
      patch.patientShare = 0;
      patch.slaDeadlineAt = null;
    } else if (response === 'PARTIAL') {
      patch.status = 'PREAUTH_PARTIAL';
      patch.approvedAmount = Number(approvedAmount);
      patch.patientShare = claim.estimatedCost - Number(approvedAmount);
      patch.slaDeadlineAt = null;
      patch.flags = [...(claim.flags||[]).filter(f => !['sla-breach','escalate'].includes(f)), 'gap'];
    } else if (response === 'DENIED') {
      patch.status = 'PREAUTH_DENIED';
      patch.approvedAmount = 0;
      patch.patientShare = claim.estimatedCost;
      patch.denialReason = notes;
      patch.slaDeadlineAt = null;
      patch.flags = [...(claim.flags||[]).filter(f => !['sla-breach','escalate'].includes(f)), 'denied'];
    }
    store.updateClaim(claim.id, patch);
    store.fireNotificationForStatus({ ...claim, ...patch }, patch.status, { approvedAmount: patch.approvedAmount });
    onClose();
  };

  return (
    <AppModal
      open={open} onClose={onClose}
      title={`Log ${insurer.name} response`}
      subtitle={`Claim ${claim.id} · ${claim.patient.name}`}
      width={560}
      footer={
        <>
          <AppBtn kind="ghost" onClick={onClose}>Cancel</AppBtn>
          <AppBtn kind="primary" icon="check" onClick={handleSubmit}>Save response</AppBtn>
        </>
      }
    >
      <div style={{ display:'flex', flexDirection:'column', gap:14 }}>
        <AppField label="Response from TPA" required>
          <div style={{ display:'grid', gridTemplateColumns:'repeat(3, 1fr)', gap:8 }}>
            {[
              { id:'APPROVED', label:'Approved in full', icon:'check', tone: PCPT_t.c.success },
              { id:'PARTIAL',  label:'Partial approval', icon:'flag',  tone: PCPT_t.c.warning },
              { id:'DENIED',   label:'Denied',           icon:'x',     tone: PCPT_t.c.error },
            ].map(opt => (
              <div key={opt.id} onClick={() => setResponse(opt.id)} style={{
                padding:'12px 10px',
                border: response === opt.id ? `2px solid ${opt.tone}` : `1px solid ${PCPT_t.c.border}`,
                borderRadius:7, cursor:'pointer',
                background: response === opt.id ? opt.tone + '12' : PCPT_t.c.surface,
                display:'flex', flexDirection:'column', alignItems:'center', gap:6,
              }}>
                <AppIcon name={opt.icon} size={18} color={opt.tone}/>
                <span style={{ fontSize:12, fontWeight: response === opt.id ? 600 : 500 }}>{opt.label}</span>
              </div>
            ))}
          </div>
        </AppField>

        {response === 'PARTIAL' && (
          <AppField label="Approved amount" required hint={`Estimate was ${PCPT_d.inr(claim.estimatedCost)} · gap will be ${PCPT_d.inr(Math.max(0, claim.estimatedCost - approvedAmount))}`}>
            <AppInput value={approvedAmount} onChange={v => setApprovedAmount(v.replace(/[^0-9]/g,''))} mono/>
          </AppField>
        )}

        <AppField label="TPA reference number" hint="Optional · helps reconcile later">
          <AppInput value={refNumber} onChange={setRefNumber} placeholder={`${insurer.logo}-2026-${Math.floor(Math.random()*99999)}`} mono/>
        </AppField>

        <AppField label="Notes / denial reason" hint={response === 'DENIED' ? 'Required for denied responses — visible in audit trail' : 'Optional'}>
          <AppTextarea value={notes} onChange={setNotes}
            placeholder={response === 'DENIED' ? 'e.g. PED waiting period not complete · DM diagnosed first time in this admission'
                       : 'Any details to capture from the TPA response'} rows={3}/>
        </AppField>

        <div style={{
          padding:'10px 12px', background: PCPT_t.c.brandSoft, borderRadius:7,
          fontSize:12, color:'#4C1D95', lineHeight:1.55,
          display:'flex', gap:8, alignItems:'flex-start',
        }}>
          <AppIcon name="whatsapp" size={14}/>
          <span>WhatsApp message will fire automatically to <strong>{claim.patient.phone}</strong> on save.</span>
        </div>
      </div>
    </AppModal>
  );
}

function RespondedCard({ claim, insurer }) {
  const isApproved = claim.status === 'PREAUTH_APPROVED' || ['ACTIVE_STAY','CLAIM_READY','CLAIM_SUBMITTED','SETTLED'].includes(claim.status);
  const isPartial  = claim.status === 'PREAUTH_PARTIAL';
  const isDenied   = claim.status === 'PREAUTH_DENIED';
  const isQuery    = claim.status === 'PREAUTH_QUERY';

  const tone = isDenied ? PCPT_t.c.error : isPartial || isQuery ? PCPT_t.c.warning : PCPT_t.c.success;
  const toneTint = isDenied ? PCPT_t.c.errorTint : isPartial || isQuery ? PCPT_t.c.warningTint : PCPT_t.c.successTint;

  return (
    <AppCard>
      <div style={{
        marginLeft:-20, marginRight:-20, marginTop:-20, marginBottom:16,
        padding:'16px 22px',
        background: toneTint,
        borderBottom: `1px solid ${PCPT_t.c.border}`,
        display:'flex', alignItems:'center', gap:14,
      }}>
        <div style={{
          width:36, height:36, borderRadius:9,
          background:'#fff', color: tone,
          display:'grid', placeItems:'center',
        }}>
          <AppIcon name={isDenied ? 'x' : isApproved ? 'check' : 'flag'} size={20}/>
        </div>
        <div style={{ flex:1 }}>
          <div style={{ fontSize:15, fontWeight:600, color: PCPT_t.c.text }}>
            {isApproved ? 'Pre-auth approved' : isPartial ? 'Partial approval' : isDenied ? 'Pre-auth denied' : 'Query raised'}
          </div>
          <div style={{ fontSize:12.5, color: PCPT_t.c.textMuted, marginTop:3 }}>
            From <strong>{insurer.name}</strong> · response logged
          </div>
        </div>
        {claim.approvedAmount != null && claim.approvedAmount > 0 && (
          <AppMoney value={claim.approvedAmount} strong size={20}/>
        )}
      </div>

      <div style={{ display:'grid', gridTemplateColumns:'1fr 1fr', gap:14 }}>
        <RespondedStat label="Estimated cost"  value={<AppMoney value={claim.estimatedCost}/>}/>
        <RespondedStat label="Approved amount" value={<AppMoney value={claim.approvedAmount} strong/>}/>
        <RespondedStat label="Patient share"   value={<AppMoney value={claim.patientShare} strong={claim.patientShare > 0} neg={claim.patientShare > 0}/>}/>
        <RespondedStat label="Deposit collected" value={<AppMoney value={claim.depositCollected}/>}/>
      </div>

      {isDenied && claim.denialReason && (
        <div style={{
          marginTop:16, padding:'10px 12px',
          background: PCPT_t.c.errorTint, borderRadius:6,
          fontSize:11.5, color:'#991B1B', lineHeight:1.55,
        }}>
          <strong style={{ fontFamily: PCPT_t.f.mono, fontSize:10, letterSpacing:'.08em', textTransform:'uppercase' }}>Denial reason:</strong><br/>
          {claim.denialReason}
        </div>
      )}

      {(isPartial || isApproved) && (
        <div style={{ marginTop:16, display:'flex', gap:8 }}>
          <a href={`#/claims/${claim.id}/charges`} style={{ textDecoration:'none' }}>
            <AppBtn kind="primary" iconRight="right">Log daily charges</AppBtn>
          </a>
        </div>
      )}
      {isDenied && (
        <div style={{ marginTop:16, display:'flex', gap:8 }}>
          <a href={`#/claims/${claim.id}/dossier`} style={{ textDecoration:'none' }}>
            <AppBtn kind="primary" iconRight="right">Convert to self-pay</AppBtn>
          </a>
        </div>
      )}
      {isQuery && (
        <div style={{ marginTop:16, display:'flex', gap:8 }}>
          <a href={`#/claims/${claim.id}/queries`} style={{ textDecoration:'none' }}>
            <AppBtn kind="primary" iconRight="right">Resolve query</AppBtn>
          </a>
        </div>
      )}
    </AppCard>
  );
}

function RespondedStat({ label, value }) {
  return (
    <div style={{
      padding:'12px 14px',
      background: PCPT_t.c.surface2, borderRadius:7,
    }}>
      <div style={{
        fontFamily: PCPT_t.f.mono, fontSize:9.5, fontWeight:600,
        letterSpacing:'.08em', textTransform:'uppercase', color: PCPT_t.c.textMuted,
        marginBottom:6,
      }}>{label}</div>
      <div>{value}</div>
    </div>
  );
}

function PDFPreviewCard({ claim, insurer }) {
  return (
    <AppCard>
      <AppSectionLabel right={<AppBtn size="sm" kind="ghost" icon="download">Download</AppBtn>}>
        Pre-auth packet · CLM-{claim.id.split('-').slice(-1)[0]}.pdf
      </AppSectionLabel>
      <div style={{ marginTop:14, display:'grid', gridTemplateColumns:'168px 1fr', gap:18 }}>
        <PDFFakeThumb/>
        <div>
          <div style={{
            fontFamily: PCPT_t.f.mono, fontSize:10, fontWeight:600,
            letterSpacing:'.08em', textTransform:'uppercase', color: PCPT_t.c.textMuted,
            marginBottom:8,
          }}>Pre-auth packet contents</div>
          <PdfRow page={1} title="Cover sheet · ROHINI stamp"/>
          <PdfRow page={2} title={`${insurer.name} pre-auth Form A+B`}/>
          <PdfRow page={3} title="Clinical pack · ICD-10 · onset · diagnostics"/>
          <PdfRow page={4} title="Hospital estimate · head-wise"/>
          <div style={{ marginTop:10, fontSize:11, color: PCPT_t.c.textDim, fontFamily: PCPT_t.f.mono, letterSpacing:'.02em' }}>
            Hospital: {PCPT_d.tenant.name} · ROHINI {PCPT_d.tenant.rohini} · GST {PCPT_d.tenant.gst}
          </div>
        </div>
      </div>
    </AppCard>
  );
}

function PdfRow({ page, title }) {
  return (
    <div style={{
      display:'flex', alignItems:'center', gap:10,
      padding:'7px 10px',
      background: PCPT_t.c.surface2, borderRadius:6,
      marginBottom:5,
    }}>
      <span style={{
        fontFamily: PCPT_t.f.mono, fontSize:10, color: PCPT_t.c.textDim,
        fontWeight:600, minWidth:24, letterSpacing:'.04em',
      }}>p.{page}</span>
      <span style={{ fontSize:12.5 }}>{title}</span>
      <div style={{ flex:1 }}/>
      <AppIcon name="check" size={12} color={PCPT_t.c.success}/>
    </div>
  );
}

function PDFFakeThumb() {
  return (
    <div style={{
      width:'100%', aspectRatio:'.78', background:'#fff',
      border: `1px solid ${PCPT_t.c.border}`, borderRadius:6,
      padding:10, fontFamily: PCPT_t.f.sans, position:'relative',
      boxShadow:'0 1px 3px rgba(0,0,0,.06)',
    }}>
      <div style={{ height:6, background: PCPT_t.c.text, borderRadius:1, width:'70%', marginBottom:6 }}/>
      <div style={{ height:3, background: PCPT_t.c.border, borderRadius:1, width:'50%', marginBottom:8 }}/>
      <div style={{ display:'flex', gap:3, marginBottom:8 }}>
        <div style={{ flex:1, height:20, background: PCPT_t.c.brandSoft, borderRadius:3 }}/>
        <div style={{ flex:1, height:20, background: PCPT_t.c.brandSoft, borderRadius:3 }}/>
      </div>
      {[1,2,3,4,5,6,7,8].map(i => (
        <div key={i} style={{
          height:2, background: PCPT_t.c.border, borderRadius:1,
          width: `${45 + (i*7) % 45}%`, marginBottom:4,
        }}/>
      ))}
      <div style={{
        position:'absolute', bottom:10, left:10, right:10,
        height:10, background: PCPT_t.c.surface3, borderRadius:1,
      }}/>
    </div>
  );
}

function SubmissionInstructions({ insurer }) {
  return (
    <AppCard>
      <AppSectionLabel>How to submit to {insurer.name}</AppSectionLabel>
      <ol style={{
        paddingLeft:18, marginTop:12, marginBottom:0,
        fontSize:12, color: PCPT_t.c.text, lineHeight:1.65,
      }}>
        <li>Download the packet PDF (left).</li>
        <li>Log in to the <strong>{insurer.name}</strong> portal.</li>
        <li>Upload the PDF as pre-auth request.</li>
        <li>Note the TPA reference number once they confirm.</li>
        <li>Come back here and <strong>Mark as submitted</strong>.</li>
      </ol>
      <div style={{
        marginTop:12, padding:'10px 12px',
        background: PCPT_t.c.surface2, borderRadius:6,
        fontSize:11, color: PCPT_t.c.textMuted, lineHeight:1.55,
      }}>
        <span style={{ fontFamily: PCPT_t.f.mono, fontSize:9.5, fontWeight:600, letterSpacing:'.08em', textTransform:'uppercase', color: PCPT_t.c.textDim, marginRight:6 }}>Portal</span>
        <span style={{ fontFamily: PCPT_t.f.mono, color: PCPT_t.c.accent }}>{insurer.portal.replace(/https?:\/\/(www\.)?/,'')}</span>
      </div>
    </AppCard>
  );
}

function SLAReferenceCard() {
  return (
    <AppCard>
      <AppSectionLabel>IRDAI SLA reference</AppSectionLabel>
      <div style={{ marginTop:10, fontSize:11.5, color: PCPT_t.c.textMuted, lineHeight:1.6 }}>
        <p style={{ margin:'0 0 8px' }}>
          IRDAI mandates a <strong style={{ color: PCPT_t.c.text }}>1-hour</strong> response window
          for cashless pre-auth requests. After the deadline, hospitals are entitled to escalate.
        </p>
        <p style={{ margin:0 }}>
          The escalation email template cites the submission timestamp and the IRDAI Health Insurance
          Regulations § 13(4).
        </p>
      </div>
    </AppCard>
  );
}

Object.assign(window, { PreAuthTab });
