/* ClearTerms — responsive layer (loaded last).
   Desktop (>1024px) keeps the original layout; everything below is opt-in via media queries. */
html{-webkit-text-size-adjust:100%}
*{-webkit-tap-highlight-color:transparent}
button,.btn,nav.tabs button,.seg button{touch-action:manipulation}
img,svg,video,canvas{max-width:100%}
.editor-actions{margin-top:12px;display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}

/* touch devices: comfortable targets, no hover "lift" */
@media (pointer:coarse){
  .btn,nav.tabs button,.seg button,select,input[type=text],input[type=password],input:not([type]){min-height:44px}
  .btn.small{min-height:40px}
  input[type=checkbox]{width:22px;height:22px}
}
@media (hover:none){ .btn:hover:not(:disabled),.contract-card:hover{transform:none;filter:none} }

/* ---------- tablets (641–1024px) ---------- */
@media screen and (min-width:641px) and (max-width:1024px){
  .wrap{padding:0 22px}
  .top-in{flex-wrap:wrap;row-gap:6px}
  nav.tabs{order:3;width:100%;margin-left:0;justify-content:center;flex-wrap:nowrap;overflow-x:auto}
  #userChipEl{margin-left:auto}
  .grid3{grid-template-columns:1fr 1fr}
  .modal{max-height:90vh;overflow:auto}
}

/* ---------- phones & small tablets (≤820px) ---------- */
@media screen and (max-width:820px){
  input,select,textarea{font-size:16px!important}   /* stops iOS zooming into fields */
  .grid2,.grid3,.checkgrid{grid-template-columns:1fr}
  table.doc{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .sigline{flex-direction:column;align-items:flex-start}
  .steps{flex-wrap:nowrap;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}
  .steps::-webkit-scrollbar{display:none}
  .steps>*{flex:0 0 auto}
}

/* ---------- phones (≤640px): app-style layout with bottom tab bar ---------- */
@media screen and (max-width:640px){
  body{padding-bottom:calc(78px + env(safe-area-inset-bottom,0px))}
  header.top{position:sticky;top:0;z-index:40;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
    padding-top:env(safe-area-inset-top,0px)}
  .wrap{padding:0 14px}
  .top-in{flex-wrap:nowrap;padding:8px 0;gap:8px}
  .logo small{display:none}
  .logo b{font-size:17px;letter-spacing:1.5px;line-height:1.1}
  .logo-mark{width:34px;height:34px;line-height:32px;font-size:18px;flex:0 0 auto}
  #userChipEl{margin-left:auto;min-width:0;font-size:12px}
  #userChipTxt{max-width:44vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #userChipTxt .pill,#userChipTxt .role{display:none}

  nav.tabs{position:fixed;left:0;right:0;bottom:0;z-index:50;margin:0;gap:0;flex-wrap:nowrap;justify-content:stretch;
    background:rgba(17,11,16,.97);border-top:1px solid var(--line);
    padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px));overflow:visible}
  nav.tabs button{flex:1 1 0;min-width:0;padding:8px 2px;font-size:11px;letter-spacing:.3px;line-height:1.2;
    border-bottom:0;border-top:2px solid transparent;border-radius:8px;white-space:normal;text-align:center}
  nav.tabs button.active{border-top-color:var(--red);background:#ffffff0d}

  .hero-new{margin:14px auto 16px}
  .hero-new .lead{font-size:15px}
  .ticks{flex-direction:column;align-items:flex-start;width:max-content;max-width:100%;margin:0 auto}
  .card{padding:16px}
  h2{font-size:26px}
  .row>.btn{flex:1 1 auto}
  .editor-panel{padding:14px 12px 18px}
  .wizard-foot{flex-wrap:wrap;gap:10px}
  .wizard-foot .btn{flex:1 1 40%}
  .editor-actions{position:sticky;bottom:calc(66px + env(safe-area-inset-bottom,0px));z-index:30;
    background:linear-gradient(180deg,transparent,var(--bg) 35%);padding:12px 0 6px}
  .editor-actions .row,.editor-actions>.btn{flex:1}
  .editor-actions .btn{flex:1 1 auto}

  /* dialogs become bottom sheets */
  .modal-bg{place-items:end center;padding:0}
  .modal{max-width:100%;border-radius:18px 18px 0 0;max-height:92dvh;max-height:92vh;overflow:auto;
    padding:22px 18px calc(22px + env(safe-area-inset-bottom,0px))}
  .gate-modal h2{font-size:32px!important}
  .toast{bottom:calc(84px + env(safe-area-inset-bottom,0px))!important;max-width:92vw}
  .site-foot{margin-top:24px}
}
@media screen and (max-width:360px){ nav.tabs button{font-size:10px} .logo b{font-size:15px} }
@media screen and (max-width:640px){ .toast{font-size:14px;letter-spacing:1px;padding:10px 16px} }
@media screen and (max-width:640px){
  nav.tabs button{font-size:11px;letter-spacing:.02em;padding:8px 2px;white-space:normal}
  .logo b{font-size:15px;letter-spacing:.05em;white-space:normal}
  #userChipEl{padding:4px 10px}
  h2{font-size:24px}
}
