.agreement-open-source{display:inline-flex;margin:2px 0 18px}
.agreement-method-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:4px 0 20px}
.agreement-method-card{min-height:112px;padding:16px;text-align:left;border:1px solid #d3dcda;border-radius:14px;background:#fff;color:#33564f;box-shadow:none}
.agreement-method-card strong,.agreement-method-card small{display:block}
.agreement-method-card strong{font:600 16px/1.35 Poppins,sans-serif;margin-bottom:7px}
.agreement-method-card small{color:#6f7d79;line-height:1.5}
.agreement-method-card.active{border-color:#b66d55;background:#fbf3ef;box-shadow:inset 0 0 0 1px #b66d55}
.agreement-sign-panel{padding-top:2px}
.agreement-consent{align-items:flex-start;margin:16px 0}
.agreement-consent input{margin-top:4px;flex:0 0 auto}
.agreement-print-steps{margin:0 0 18px;padding-left:22px;color:#536762;line-height:1.65}
@media(max-width:640px){.agreement-method-grid{grid-template-columns:1fr}.agreement-method-card{min-height:auto}.agreement-sign-panel .dialog-actions{align-items:stretch}.agreement-sign-panel .dialog-actions>*{width:100%;justify-content:center}}
.agreement-generated-status{margin-top:14px}
.agreement-result-links{display:flex;flex-wrap:wrap;gap:14px;margin-top:10px}
.agreement-result-links a{font-weight:700;color:#33564f}

/* Agreement preparation modal: keep fields inside the mobile card. */
#tipAgreementStaffForm,
#tipAgreementStaffForm .field-group{
  min-width:0;
  max-width:100%;
}
#tipAgreementStaffForm input,
#tipAgreementStaffForm textarea,
#tipAgreementStaffForm select{
  box-sizing:border-box;
  display:block;
  width:100%;
  max-width:100%;
  min-width:0;
}
@media(max-width:640px){
  .dialog:has(#tipAgreementStaffForm){
    width:calc(100vw - 24px);
    padding:24px 18px;
  }
  .dialog:has(#tipAgreementStaffForm) h2{
    max-width:100%;
    padding-right:46px;
    font-size:clamp(24px,7.2vw,31px);
    line-height:1.14;
    overflow-wrap:anywhere;
  }
  #tipAgreementStaffForm input,
  #tipAgreementStaffForm textarea,
  #tipAgreementStaffForm select{
    font-size:16px;
  }
  #tipAgreementStaffForm .dialog-actions{
    align-items:stretch;
  }
  #tipAgreementStaffForm .dialog-actions>*{
    flex:1 1 100%;
    width:100%;
    justify-content:center;
  }
}

/* iOS gives native date controls a large intrinsic width. Contain and
   override that width so the controls cannot push outside the dialog. */
#tipAgreementStaffForm .field-group:has(input[type="date"]){
  contain:inline-size;
  width:100%;
  max-width:100%;
  overflow:hidden;
}
#tipAgreementStaffForm input[type="date"]{
  box-sizing:border-box !important;
  min-width:0 !important;
  max-width:100% !important;
  width:100% !important;
  min-inline-size:0 !important;
  max-inline-size:100% !important;
  inline-size:100% !important;
  -webkit-appearance:none;
  appearance:none;
  overflow:hidden;
}
#tipAgreementStaffForm input[type="date"]::-webkit-date-and-time-value{
  min-width:0;
  text-align:left;
}
@media(max-width:640px){
  #tipAgreementStaffForm input[type="date"]{
    width:-webkit-fill-available !important;
    inline-size:-webkit-fill-available !important;
  }
  #tipAgreementStaffForm .dialog-actions{
    display:grid;
    grid-template-columns:minmax(0,1fr);
    width:100%;
  }
  #tipAgreementStaffForm .dialog-actions>*{
    min-width:0;
    max-width:100%;
  }
}


/* TIP agreement review: show the released agreement before signing. */
.agreement-source-card{margin:8px 0 22px;padding:14px;border:1px solid #d3dcda;border-radius:16px;background:#f7faf9}
.agreement-source-header{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:12px}
.agreement-source-header strong,.agreement-source-header small{display:block}
.agreement-source-header strong{color:#33564f;font:600 15px/1.4 Poppins,sans-serif;overflow-wrap:anywhere}
.agreement-source-header small{margin-top:3px;color:#6f7d79}
.agreement-source-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}
.agreement-source-actions .secondary-button{min-height:42px;padding:10px 14px}
.agreement-pdf-preview{display:block;width:100%;height:min(58vh,620px);border:1px solid #d3dcda;border-radius:12px;background:#fff}
.agreement-preview-fallback{margin:10px 2px 0;color:#6f7d79;font-size:13px;line-height:1.45}
@media(max-width:640px){
  .dialog:has(.agreement-source-card){width:calc(100vw - 24px);padding:24px 18px}
  .dialog:has(.agreement-source-card) h2{padding-right:46px;font-size:clamp(25px,8vw,34px);line-height:1.12}
  .agreement-source-header{align-items:stretch;flex-direction:column}
  .agreement-source-actions{display:grid;grid-template-columns:1fr}
  .agreement-source-actions>*{width:100%;justify-content:center}
  .agreement-pdf-preview{height:52vh;min-height:360px}
  .agreement-sign-panel input{font-size:16px}
}
